





<!DOCTYPE html>
<html class="writer-html5" lang="zh-CN" >
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>tvm.autotvm &mdash; tvm 0.8.dev1982 文档</title>
  

  
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  <link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/gallery.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/tlcpack_theme.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../../_static/tvm-logo-square.png"/>
  

  
  
  
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/underscore.js"></script>
        <script src="../../../_static/doctools.js"></script>
        <script src="../../../_static/translations.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    
    <script type="text/javascript" src="../../../_static/js/tlcpack_theme.js"></script>
    <link rel="index" title="索引" href="../../../genindex.html" />
    <link rel="search" title="搜索" href="../../../search.html" />
    <link rel="next" title="tvm.auto_scheduler" href="auto_scheduler.html" />
    <link rel="prev" title="tvm.relay.testing" href="relay/testing.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    
<header class="header">
    <div class="innercontainer">
      <div class="headerInner d-flex justify-content-between align-items-center">
          <div class="headerLogo">
               <a href="https://tvm.apache.org/"><img src=https://tvm.apache.org/assets/images/logo.svg alt="logo"></a>
          </div>

          <div id="headMenu" class="headerNav">
            <button type="button" id="closeHeadMenu" class="navCloseBtn"><img src="../../../_static/img/close-icon.svg" alt="Close"></button>
             <ul class="nav">
                <li class="nav-item">
                   <a class="nav-link" href=https://tvm.apache.org/community>Community</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvm.apache.org/download>Download</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvm.apache.org/vta>VTA</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvm.apache.org/blog>Blog</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvm.apache.org/docs>Docs</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvmconf.org>Conference</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://github.com/apache/tvm/>Github</a>
                </li>
                <li class="nav-item">
                   <a class="nav-link" href=https://tvmchinese.github.io/declaration_zh_CN.html>About-Translators</a>
                </li>
             </ul>
               <div class="responsivetlcdropdown">
                 <button type="button" class="btn-link">
                   ASF
                 </button>
                 <ul>
                     <li>
                       <a href=https://apache.org/>Apache Homepage</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/licenses/>License</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/foundation/sponsorship.html>Sponsorship</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/security/>Security</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/foundation/thanks.html>Thanks</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/events/current-event>Events</a>
                     </li>
                     <li>
                       <a href=https://www.zhihu.com/column/c_1429578595417563136>Zhihu</a>
                     </li>
                 </ul>
               </div>
          </div>
            <div class="responsiveMenuIcon">
              <button type="button" id="menuBtn" class="btn-menu"><img src="../../../_static/img/menu-icon.svg" alt="Menu Icon"></button>
            </div>

            <div class="tlcDropdown">
              <div class="dropdown">
                <button type="button" class="btn-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                  ASF
                </button>
                <div class="dropdown-menu dropdown-menu-right">
                  <ul>
                     <li>
                       <a href=https://apache.org/>Apache Homepage</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/licenses/>License</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/foundation/sponsorship.html>Sponsorship</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/security/>Security</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/foundation/thanks.html>Thanks</a>
                     </li>
                     <li>
                       <a href=https://www.apache.org/events/current-event>Events</a>
                     </li>
                     <li>
                       <a href=https://www.zhihu.com/column/c_1429578595417563136>Zhihu</a>
                     </li>
                  </ul>
                </div>
              </div>
          </div>
       </div>
    </div>
 </header>
 
    <nav data-toggle="wy-nav-shift" class="wy-nav-side fixed">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="../../../index.html">
          

          
            
            <img src="../../../_static/tvm-logo-small.png" class="logo" alt="Logo"/>
          
          </a>

          
            
            
                <div class="version">
                  0.8.dev1982
                </div>
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <p class="caption" role="heading"><span class="caption-text">如何开始</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../install/index.html">安装 TVM</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../contribute/index.html">贡献者指南</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">用户引导</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../tutorial/index.html">User Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../how_to/index.html">How To Guides</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">开发者引导</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/tutorial/index.html">Developer Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/how_to/how_to.html">开发者指南</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">架构指南</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../arch/index.html">Design and Architecture</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">主题引导</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../topic/microtvm/index.html">microTVM：裸机使用TVM</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../topic/vta/index.html">VTA: Versatile Tensor Accelerator</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">参考指南</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../langref/index.html">语言参考</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Python API</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="runtime.html">tvm.runtime</a></li>
<li class="toctree-l2"><a class="reference internal" href="ndarray.html">tvm.runtime.ndarray</a></li>
<li class="toctree-l2"><a class="reference internal" href="error.html">tvm.error</a></li>
<li class="toctree-l2"><a class="reference internal" href="ir.html">tvm.ir</a></li>
<li class="toctree-l2"><a class="reference internal" href="ir.html#module-tvm.instrument">tvm.instrument</a></li>
<li class="toctree-l2"><a class="reference internal" href="ir.html#module-tvm.transform">tvm.transform</a></li>
<li class="toctree-l2"><a class="reference internal" href="target.html">tvm.target</a></li>
<li class="toctree-l2"><a class="reference internal" href="tir.html">tvm.tir</a></li>
<li class="toctree-l2"><a class="reference internal" href="tir.html#module-tvm.tir.transform">tvm.tir.transform</a></li>
<li class="toctree-l2"><a class="reference internal" href="tir.html#tvm-tir-analysis">tvm.tir.analysis</a></li>
<li class="toctree-l2"><a class="reference internal" href="tir.html#module-tvm.tir.stmt_functor">tvm.tir.stmt_functor</a></li>
<li class="toctree-l2"><a class="reference internal" href="te.html">tvm.te</a></li>
<li class="toctree-l2"><a class="reference internal" href="te.html#module-tvm.te.hybrid">tvm.te.hybrid</a></li>
<li class="toctree-l2"><a class="reference internal" href="driver.html">tvm.driver</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/index.html">tvm.relay</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/frontend.html">tvm.relay.frontend</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/nn.html">tvm.relay.nn</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/vision.html">tvm.relay.vision</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/image.html">tvm.relay.image</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/transform.html">tvm.relay.transform</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/analysis.html">tvm.relay.analysis</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/backend.html">tvm.relay.backend</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/dataflow_pattern.html">tvm.relay.dataflow_pattern</a></li>
<li class="toctree-l2"><a class="reference internal" href="relay/testing.html">tvm.relay.testing</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">tvm.autotvm</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#module-tvm.autotvm.measure.measure">tvm.autotvm.measure</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-tvm.autotvm.tuner">tvm.autotvm.tuner</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-tvm.autotvm.task">tvm.autotvm.task</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-tvm.autotvm.record">tvm.autotvm.record</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="auto_scheduler.html">tvm.auto_scheduler</a></li>
<li class="toctree-l2"><a class="reference internal" href="rpc.html">tvm.rpc</a></li>
<li class="toctree-l2"><a class="reference internal" href="micro.html">tvm.micro</a></li>
<li class="toctree-l2"><a class="reference internal" href="contrib.html">tvm.contrib</a></li>
<li class="toctree-l2"><a class="reference internal" href="graph_executor.html">tvm.contrib.graph_executor</a></li>
<li class="toctree-l2"><a class="reference internal" href="topi.html">tvm.topi</a></li>
<li class="toctree-l2"><a class="reference internal" href="vta/index.html">vta</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../links.html">Other APIs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../publications.html">Publications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../genindex.html">索引</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
      
      <nav class="wy-nav-top" aria-label="top navigation" data-toggle="wy-nav-top">
        
            <div class="togglemenu">

            </div>
            <div class="nav-content">
              <!-- tvm -->
              Table of content
            </div>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        

          




















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../../index.html">Docs</a> <span class="br-arrow">></span></li>
        
          <li><a href="index.html">Python API</a> <span class="br-arrow">></span></li>
        
      <li>tvm.autotvm</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="../../../_sources/reference/api/python/autotvm.rst.txt" rel="nofollow"> <img src="../../../_static//img/source.svg" alt="viewsource"/></a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="module-tvm.autotvm">
<span id="tvm-autotvm"></span><h1>tvm.autotvm<a class="headerlink" href="#module-tvm.autotvm" title="永久链接至标题">¶</a></h1>
<p>The auto-tuning module of tvm</p>
<p>This module includes:</p>
<ul class="simple">
<li><p>Tuning space definition API</p></li>
<li><p>Efficient auto-tuners</p></li>
<li><p>Tuning result and database support</p></li>
<li><p>Distributed measurement to scale up tuning</p></li>
</ul>
<dl class="py function">
<dt class="sig sig-object py" id="tvm.autotvm.apply_history_best">
<span class="sig-prename descclassname"><span class="pre">tvm.autotvm.</span></span><span class="sig-name descname"><span class="pre">apply_history_best</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">records</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.apply_history_best" title="永久链接至目标">¶</a></dt>
<dd><p>Apply the history best config</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>records</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em> or </em><em>iterator of</em><em> (</em><a class="reference internal" href="#tvm.autotvm.measure.MeasureInput" title="tvm.autotvm.measure.MeasureInput"><em>autotvm.measure.MeasureInput</em></a><em>, </em><a class="reference internal" href="#tvm.autotvm.measure.MeasureResult" title="tvm.autotvm.measure.MeasureResult"><em>autotvm.measure.MeasureResult</em></a><em>)</em>) – Collection of tuning records.
If is str, then it should be the filename of a records log file.
Each row of this file is an encoded record pair. Otherwise, it is an iterator.</p>
</dd>
</dl>
</dd></dl>

<div class="section" id="module-tvm.autotvm.measure.measure">
<span id="tvm-autotvm-measure"></span><h2>tvm.autotvm.measure<a class="headerlink" href="#module-tvm.autotvm.measure.measure" title="永久链接至标题">¶</a></h2>
<p>User facing API for specifying how to measure the generated code</p>
<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.measure.MeasureInput">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.measure.</span></span><span class="sig-name descname"><span class="pre">MeasureInput</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">target</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">task</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">config</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.measure.MeasureInput" title="永久链接至目标">¶</a></dt>
<dd><p>Stores all the necessary inputs for a measurement.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>target</strong> (<a class="reference internal" href="target.html#tvm.target.Target" title="tvm.target.Target"><em>tvm.target.Target</em></a>) – The target device</p></li>
<li><p><strong>task</strong> (<a class="reference internal" href="#tvm.autotvm.task.task.Task" title="tvm.autotvm.task.task.Task"><em>task.Task</em></a>) – Task function</p></li>
<li><p><strong>config</strong> (<a class="reference internal" href="#tvm.autotvm.task.space.ConfigEntity" title="tvm.autotvm.task.space.ConfigEntity"><em>ConfigEntity</em></a>) – Specific configuration.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.measure.MeasureResult">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.measure.</span></span><span class="sig-name descname"><span class="pre">MeasureResult</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">costs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">error_no</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">all_cost</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timestamp</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.measure.MeasureResult" title="永久链接至目标">¶</a></dt>
<dd><p>Stores all the results of a measurement</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>costs</strong> (<em>Array of float</em><em> or </em><em>Array of Exception</em>) – If no error occurs during measurement, it is an array of measured running times.
If an error occurs during measurement, it is an array of the exception objections.</p></li>
<li><p><strong>error_no</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – 表示错误类型， 由MeasureErrorNo定义</p></li>
<li><p><strong>all_cost</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(在 Python v3.10)"><em>float</em></a>) – All cost of this measure, including rpc, compilation, test runs</p></li>
<li><p><strong>timestamp</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(在 Python v3.10)"><em>float</em></a>) – 完成测量时的绝对时间戳</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.autotvm.measure.measure_option">
<span class="sig-prename descclassname"><span class="pre">tvm.autotvm.measure.</span></span><span class="sig-name descname"><span class="pre">measure_option</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">builder</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">runner</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.measure.measure_option" title="永久链接至目标">¶</a></dt>
<dd><p>Set options for measure. To measure a config, we will build it and run it.
So we have to set options for these two steps.
They have their own options on timeout, parallel, etc.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>builder</strong> (<em>Builder</em>) – Specify how to build programs</p></li>
<li><p><strong>runner</strong> (<em>Runner</em>) – Specify how to run programs</p></li>
</ul>
</dd>
</dl>
<p class="rubric">实际案例</p>
<p># example setting for using local devices
&gt;&gt;&gt; measure_option = autotvm.measure_option(
&gt;&gt;&gt;     builder=autotvm.LocalBuilder(),      # use all local cpu cores for compilation
&gt;&gt;&gt;     runner=autotvm.LocalRunner(          # measure them sequentially
&gt;&gt;&gt;         number=10,
&gt;&gt;&gt;         timeout=5)
&gt;&gt;&gt; )</p>
<p># example setting for using remote devices
&gt;&gt;&gt; measure_option = autotvm.measure_option(
&gt;&gt;&gt;    builder=autotvm.LocalBuilder(),  # use all local cpu cores for compilation
&gt;&gt;&gt;    runner=autotvm.RPCRunner(
&gt;&gt;&gt;        ‘rasp3b’, ‘locahost’, 9190, # device key, host and port of the rpc tracker
&gt;&gt;&gt;        number=4,
&gt;&gt;&gt;        timeout=4) # timeout of a run on the device. RPC request waiting time is excluded.
&gt;&gt;&gt;)</p>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>为了使测量结果准确，您应该为 Runner() 中的参数 <cite>number</cite> 和 <cite>repeat</cite> 选择正确的值。某些设备需要一定的最短运行时间来“预热”，例如 GPU 需要时间才能达到性能最佳状态。推荐使用`min_repeat_ms`，因为它可以动态调 <cite>number</cite>。 NVIDIA GPU 的典型值为 150 毫秒</p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.autotvm.measure.create_measure_batch">
<span class="sig-prename descclassname"><span class="pre">tvm.autotvm.measure.</span></span><span class="sig-name descname"><span class="pre">create_measure_batch</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">task</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">option</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.measure.create_measure_batch" title="永久链接至目标">¶</a></dt>
<dd><p>获取标准的 measure_batch 函数</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>task</strong> (<em>tvm.autotvm.task.Task</em>) – The tuning task</p></li>
<li><p><strong>option</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(在 Python v3.10)"><em>dict</em></a>) – 测量生成代码的选项。您应该使用 function:any:<cite>measure_option</cite> 的返回值。</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>measure_batch</strong> – a callback function to measure a batch of configs</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>callable</p>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.measure.measure_methods.LocalBuilder">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.measure.measure_methods.</span></span><span class="sig-name descname"><span class="pre">LocalBuilder</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">timeout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">10</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n_parallel</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">build_kwargs</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">build_func</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'default'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">do_fork</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.measure.measure_methods.LocalBuilder" title="永久链接至目标">¶</a></dt>
<dd><p>在本地机器上运行编译</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>timeout</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(在 Python v3.10)"><em>float</em></a>) – 编译超时</p></li>
<li><p><strong>n_parallel</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – 多个任务并行运行。 “None”将使用所有 CPU 内核</p></li>
<li><p><strong>build_kwargs</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(在 Python v3.10)"><em>dict</em></a>) – 如果提供额外的 kwargs 传递给 build_func。覆盖 Runner 提供的任何 build_kwargs</p></li>
<li><p><strong>build_func</strong> (<em>callable</em><em> or </em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – If is ‘default’, use default build function
If is ‘ndk’, use function for android ndk
If id ‘stackvm’, use function for stackvm
If is callable, use it as custom build function, expect lib_format field.</p></li>
<li><p><strong>do_fork</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a>) – If False, do not fork when building. Requires n_parallel=1.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.measure.measure_methods.RPCRunner">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.measure.measure_methods.</span></span><span class="sig-name descname"><span class="pre">RPCRunner</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">key</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">host</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">port</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">priority</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">10</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n_parallel</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">number</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">4</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">repeat</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">3</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">min_repeat_ms</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cooldown_interval</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">enable_cpu_cache_flush</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">module_loader</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.measure.measure_methods.RPCRunner" title="永久链接至目标">¶</a></dt>
<dd><p>Run generated code on remove devices.
This function will ask a RPC Tracker to get device for measurement.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>timeout</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(在 Python v3.10)"><em>float</em></a>) – The timeout of a RPCRunner measurement task</p></li>
<li><p><strong>n_parallel</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – 多个任务并行运行。 “None”将使用所有 CPU 内核</p></li>
<li><p><strong>key</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The key of the device registered in the tracker</p></li>
<li><p><strong>host</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The host address of RPC Tracker</p></li>
<li><p><strong>port</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – The port of RPC Tracker</p></li>
<li><p><strong>number</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – The number of times to run the generated code for taking average.
We call these runs as one <cite>repeat</cite> of measurement.</p></li>
<li><p><strong>repeat</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a><em>, </em><em>optional</em>) – The number of times to repeat the measurement.
In total, the generated code will be run (1 + number x repeat) times,
where the first “1” is warm up and will be discarded.
The returned result contains <cite>repeat</cite> costs,
each of which is an average of <cite>number</cite> costs.</p></li>
<li><p><strong>min_repeat_ms</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a><em>, </em><em>optional</em>) – The minimum duration of one <cite>repeat</cite> in milliseconds.
By default, one <cite>repeat</cite> contains <cite>number</cite> runs. If this parameter is set,
the parameters <cite>number</cite> will be dynamically adjusted to meet the
minimum duration requirement of one <cite>repeat</cite>.
i.e., When the run time of one <cite>repeat</cite> falls below this time, the <cite>number</cite> parameter
will be automatically increased.</p></li>
<li><p><strong>cooldown_interval</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(在 Python v3.10)"><em>float</em></a><em>, </em><em>optional</em>) – The cool down interval between two measurements.</p></li>
<li><p><strong>enable_cpu_cache_flush</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a>) – Whether to flush cache on CPU between repeated measurements.
Flushing cache can make the measured latency of one operator closer to
its actual latency during end-to-end inference.
To make this option effective, the argument <cite>number</cite> should also be set to 1.
This is only has effect on CPU task.</p></li>
<li><p><strong>module_loader</strong> (<em>ModuleLoader</em>) – If given, a context manager that loads the module to be timed into the remote runtime.
If not given, default_module_loader is used.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.measure.measure_methods.LocalRunner">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.measure.measure_methods.</span></span><span class="sig-name descname"><span class="pre">LocalRunner</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">timeout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">10</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">number</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">4</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">repeat</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">3</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">min_repeat_ms</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cooldown_interval</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">enable_cpu_cache_flush</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">module_loader</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.measure.measure_methods.LocalRunner" title="永久链接至目标">¶</a></dt>
<dd><p>Run generated code on local devices.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>timeout</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(在 Python v3.10)"><em>float</em></a>) – 编译超时</p></li>
<li><p><strong>number</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – The number of times to run the generated code for taking average.
We call these runs as one <cite>repeat</cite> of measurement.</p></li>
<li><p><strong>repeat</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a><em>, </em><em>optional</em>) – The number of times to repeat the measurement.
In total, the generated code will be run (1 + number x repeat) times,
where the first one is warm up and will be discarded.
The returned result contains <cite>repeat</cite> costs,
each of which is an average of <cite>number</cite> costs.</p></li>
<li><p><strong>min_repeat_ms</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a><em>, </em><em>optional</em>) – The minimum duration of one <cite>repeat</cite> in milliseconds.
By default, one <cite>repeat</cite> contains <cite>number</cite> runs. If this parameter is set,
the parameters <cite>number</cite> will be dynamically adjusted to meet the
minimum duration requirement of one <cite>repeat</cite>.
i.e., When the run time of one <cite>repeat</cite> falls below this time, the <cite>number</cite> parameter
will be automatically increased.</p></li>
<li><p><strong>cooldown_interval</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(在 Python v3.10)"><em>float</em></a><em>, </em><em>optional</em>) – The cool down interval between two measurements.</p></li>
<li><p><strong>enable_cpu_cache_flush</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a>) – Whether to flush cache on CPU between repeated measurements.
Flushing cache can make the measured latency of one operator closer to
its actual latency during end-to-end inference.
To make this option effective, the argument <cite>number</cite> should also be set to 1.
This is only has effect on CPU task.</p></li>
</ul>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>This is a “fake” local mode. We start a silent rpc tracker and rpc server
for the user. In this way we reuse timeout/isolation mechanism in RPC infrastructure.</p>
</div>
</dd></dl>

</div>
<div class="section" id="module-tvm.autotvm.tuner">
<span id="tvm-autotvm-tuner"></span><h2>tvm.autotvm.tuner<a class="headerlink" href="#module-tvm.autotvm.tuner" title="永久链接至标题">¶</a></h2>
<p>A tuner takes a task as input. It proposes some promising <a class="reference internal" href="#tvm.autotvm.task.space.ConfigEntity" title="tvm.autotvm.task.space.ConfigEntity"><code class="xref any py py-class docutils literal notranslate"><span class="pre">ConfigEntity</span></code></a>
in the <a class="reference internal" href="#tvm.autotvm.task.space.ConfigSpace" title="tvm.autotvm.task.space.ConfigSpace"><code class="xref any py py-class docutils literal notranslate"><span class="pre">ConfigSpace</span></code></a> and measure them on the real hardware. Then it
proposed the next batch of <a class="reference internal" href="#tvm.autotvm.task.space.ConfigEntity" title="tvm.autotvm.task.space.ConfigEntity"><code class="xref any py py-class docutils literal notranslate"><span class="pre">ConfigEntity</span></code></a> according to the measure results.
This tuning loop is repeated.</p>
<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.Tuner">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.tuner.</span></span><span class="sig-name descname"><span class="pre">Tuner</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">task</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.Tuner" title="永久链接至目标">¶</a></dt>
<dd><p>Base class for tuners</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>task</strong> (<em>autotvm.task.Task</em>) – Tuning Task</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.Tuner.has_next">
<span class="sig-name descname"><span class="pre">has_next</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.Tuner.has_next" title="永久链接至目标">¶</a></dt>
<dd><p>Whether has next untried config in the space</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>has_next</strong></p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)">bool</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.Tuner.next_batch">
<span class="sig-name descname"><span class="pre">next_batch</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">batch_size</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.Tuner.next_batch" title="永久链接至目标">¶</a></dt>
<dd><p>get the next batch of configs to be measure on real hardware</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>batch_size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – The size of the batch</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p></p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>a batch of configs</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.Tuner.update">
<span class="sig-name descname"><span class="pre">update</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">inputs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">results</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.Tuner.update" title="永久链接至目标">¶</a></dt>
<dd><p>Update parameters of the tuner according to measurement results</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>inputs</strong> (<em>Array of autotvm.measure.MeasureInput</em>) – The input for measurement</p></li>
<li><p><strong>results</strong> (<em>Array of autotvm.measure.MeasureResult</em>) – result for measurement</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.Tuner.tune">
<span class="sig-name descname"><span class="pre">tune</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n_trial</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">measure_option</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">early_stopping</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">callbacks</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">()</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">si_prefix</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'G'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.Tuner.tune" title="永久链接至目标">¶</a></dt>
<dd><p>Begin tuning</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>n_trial</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – Maximum number of configs to try (measure on real hardware)</p></li>
<li><p><strong>measure_option</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(在 Python v3.10)"><em>dict</em></a>) – The options for how to measure generated code.
You should use the return value ot autotvm.measure_option for this argument.</p></li>
<li><p><strong>early_stopping</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a><em>, </em><em>optional</em>) – Early stop the tuning when not finding better configs in this number of trials</p></li>
<li><p><strong>callbacks</strong> (<em>List of callable</em>) – A list of callback functions. The signature of callback function is
(Tuner, List of MeasureInput, List of MeasureResult)
with no return value. These callback functions will be called on
every measurement pair. See autotvm/tuner/callback.py for some examples.</p></li>
<li><p><strong>si_prefix</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – One of tvm.autotvm.utils.SI_PREFIXES. The SI prefix to use when reporting FLOPS.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.Tuner.reset">
<span class="sig-name descname"><span class="pre">reset</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.Tuner.reset" title="永久链接至目标">¶</a></dt>
<dd><p>reset the status of tuner</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.Tuner.load_history">
<span class="sig-name descname"><span class="pre">load_history</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data_set</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">min_seed_records</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">500</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.Tuner.load_history" title="永久链接至目标">¶</a></dt>
<dd><p>load history data for transfer learning</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>data_set</strong> (<em>Array of</em><em> (</em><a class="reference internal" href="#tvm.autotvm.measure.MeasureInput" title="tvm.autotvm.measure.MeasureInput"><em>autotvm.measure.MeasureInput</em></a><em>, </em><a class="reference internal" href="#tvm.autotvm.measure.MeasureResult" title="tvm.autotvm.measure.MeasureResult"><em>autotvm.measure.MeasureResult</em></a><em>) </em><em>pair</em>) – Previous tuning records</p></li>
<li><p><strong>min_seed_records</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – Defaults to 500. Indicates the minimum number of records to
train the tuner with. If there are less than <cite>min_seed_records</cite>
number of records in <cite>data_set</cite>, no training of the tuner
will be done.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.RandomTuner">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.tuner.</span></span><span class="sig-name descname"><span class="pre">RandomTuner</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">task</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">range_idx</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.RandomTuner" title="永久链接至目标">¶</a></dt>
<dd><p>Enumerate the search space in a random order</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>task</strong> (<em>autotvm.task.Task</em>) – Tuning Task</p></li>
<li><p><strong>range_idx</strong> (<em>Optional</em><em>[</em><em>Tuple</em><em>[</em><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a><em>, </em><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a><em>]</em><em>]</em>) – A tuple of index range to random</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.RandomTuner.has_next">
<span class="sig-name descname"><span class="pre">has_next</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.RandomTuner.has_next" title="永久链接至目标">¶</a></dt>
<dd><p>Whether has next untried config in the space</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>has_next</strong></p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)">bool</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.RandomTuner.load_history">
<span class="sig-name descname"><span class="pre">load_history</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data_set</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">min_seed_records</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">500</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.RandomTuner.load_history" title="永久链接至目标">¶</a></dt>
<dd><p>load history data for transfer learning</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>data_set</strong> (<em>Array of</em><em> (</em><a class="reference internal" href="#tvm.autotvm.measure.MeasureInput" title="tvm.autotvm.measure.MeasureInput"><em>autotvm.measure.MeasureInput</em></a><em>, </em><a class="reference internal" href="#tvm.autotvm.measure.MeasureResult" title="tvm.autotvm.measure.MeasureResult"><em>autotvm.measure.MeasureResult</em></a><em>) </em><em>pair</em>) – Previous tuning records</p></li>
<li><p><strong>min_seed_records</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – Defaults to 500. Indicates the minimum number of records to
train the tuner with. If there are less than <cite>min_seed_records</cite>
number of records in <cite>data_set</cite>, no training of the tuner
will be done.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.RandomTuner.reset">
<span class="sig-name descname"><span class="pre">reset</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.RandomTuner.reset" title="永久链接至目标">¶</a></dt>
<dd><p>reset the status of tuner</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.RandomTuner.tune">
<span class="sig-name descname"><span class="pre">tune</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n_trial</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">measure_option</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">early_stopping</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">callbacks</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">()</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">si_prefix</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'G'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.RandomTuner.tune" title="永久链接至目标">¶</a></dt>
<dd><p>Begin tuning</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>n_trial</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – Maximum number of configs to try (measure on real hardware)</p></li>
<li><p><strong>measure_option</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(在 Python v3.10)"><em>dict</em></a>) – The options for how to measure generated code.
You should use the return value ot autotvm.measure_option for this argument.</p></li>
<li><p><strong>early_stopping</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a><em>, </em><em>optional</em>) – Early stop the tuning when not finding better configs in this number of trials</p></li>
<li><p><strong>callbacks</strong> (<em>List of callable</em>) – A list of callback functions. The signature of callback function is
(Tuner, List of MeasureInput, List of MeasureResult)
with no return value. These callback functions will be called on
every measurement pair. See autotvm/tuner/callback.py for some examples.</p></li>
<li><p><strong>si_prefix</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – One of tvm.autotvm.utils.SI_PREFIXES. The SI prefix to use when reporting FLOPS.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.RandomTuner.update">
<span class="sig-name descname"><span class="pre">update</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">inputs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">results</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.RandomTuner.update" title="永久链接至目标">¶</a></dt>
<dd><p>Update parameters of the tuner according to measurement results</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>inputs</strong> (<em>Array of autotvm.measure.MeasureInput</em>) – The input for measurement</p></li>
<li><p><strong>results</strong> (<em>Array of autotvm.measure.MeasureResult</em>) – result for measurement</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.RandomTuner.next_batch">
<span class="sig-name descname"><span class="pre">next_batch</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">batch_size</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.RandomTuner.next_batch" title="永久链接至目标">¶</a></dt>
<dd><p>get the next batch of configs to be measure on real hardware</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>batch_size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – The size of the batch</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p></p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>a batch of configs</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.GridSearchTuner">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.tuner.</span></span><span class="sig-name descname"><span class="pre">GridSearchTuner</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">task</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">range_idx</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.GridSearchTuner" title="永久链接至目标">¶</a></dt>
<dd><p>Enumerate the search space in a grid search order</p>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.GridSearchTuner.next_batch">
<span class="sig-name descname"><span class="pre">next_batch</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">batch_size</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.GridSearchTuner.next_batch" title="永久链接至目标">¶</a></dt>
<dd><p>get the next batch of configs to be measure on real hardware</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>batch_size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – The size of the batch</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p></p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>a batch of configs</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.GridSearchTuner.has_next">
<span class="sig-name descname"><span class="pre">has_next</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.GridSearchTuner.has_next" title="永久链接至目标">¶</a></dt>
<dd><p>Whether has next untried config in the space</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>has_next</strong></p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)">bool</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.GridSearchTuner.load_history">
<span class="sig-name descname"><span class="pre">load_history</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data_set</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">min_seed_records</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">500</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.GridSearchTuner.load_history" title="永久链接至目标">¶</a></dt>
<dd><p>load history data for transfer learning</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>data_set</strong> (<em>Array of</em><em> (</em><a class="reference internal" href="#tvm.autotvm.measure.MeasureInput" title="tvm.autotvm.measure.MeasureInput"><em>autotvm.measure.MeasureInput</em></a><em>, </em><a class="reference internal" href="#tvm.autotvm.measure.MeasureResult" title="tvm.autotvm.measure.MeasureResult"><em>autotvm.measure.MeasureResult</em></a><em>) </em><em>pair</em>) – Previous tuning records</p></li>
<li><p><strong>min_seed_records</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – Defaults to 500. Indicates the minimum number of records to
train the tuner with. If there are less than <cite>min_seed_records</cite>
number of records in <cite>data_set</cite>, no training of the tuner
will be done.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.GridSearchTuner.reset">
<span class="sig-name descname"><span class="pre">reset</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.GridSearchTuner.reset" title="永久链接至目标">¶</a></dt>
<dd><p>reset the status of tuner</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.GridSearchTuner.tune">
<span class="sig-name descname"><span class="pre">tune</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n_trial</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">measure_option</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">early_stopping</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">callbacks</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">()</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">si_prefix</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'G'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.GridSearchTuner.tune" title="永久链接至目标">¶</a></dt>
<dd><p>Begin tuning</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>n_trial</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – Maximum number of configs to try (measure on real hardware)</p></li>
<li><p><strong>measure_option</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(在 Python v3.10)"><em>dict</em></a>) – The options for how to measure generated code.
You should use the return value ot autotvm.measure_option for this argument.</p></li>
<li><p><strong>early_stopping</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a><em>, </em><em>optional</em>) – Early stop the tuning when not finding better configs in this number of trials</p></li>
<li><p><strong>callbacks</strong> (<em>List of callable</em>) – A list of callback functions. The signature of callback function is
(Tuner, List of MeasureInput, List of MeasureResult)
with no return value. These callback functions will be called on
every measurement pair. See autotvm/tuner/callback.py for some examples.</p></li>
<li><p><strong>si_prefix</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – One of tvm.autotvm.utils.SI_PREFIXES. The SI prefix to use when reporting FLOPS.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.GridSearchTuner.update">
<span class="sig-name descname"><span class="pre">update</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">inputs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">results</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.GridSearchTuner.update" title="永久链接至目标">¶</a></dt>
<dd><p>Update parameters of the tuner according to measurement results</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>inputs</strong> (<em>Array of autotvm.measure.MeasureInput</em>) – The input for measurement</p></li>
<li><p><strong>results</strong> (<em>Array of autotvm.measure.MeasureResult</em>) – result for measurement</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.GATuner">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.tuner.</span></span><span class="sig-name descname"><span class="pre">GATuner</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">task</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pop_size</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">100</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">elite_num</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">3</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mutation_prob</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.GATuner" title="永久链接至目标">¶</a></dt>
<dd><p>Tuner with genetic algorithm.
This tuner does not have a cost model so it always run measurement on real machines.
This tuner expands the <code class="code docutils literal notranslate"><span class="pre">ConfigEntity</span></code> as gene.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>pop_size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – number of genes in one generation</p></li>
<li><p><strong>elite_num</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – number of elite to keep</p></li>
<li><p><strong>mutation_prob</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(在 Python v3.10)"><em>float</em></a>) – probability of mutation of a knob in a gene</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.GATuner.next_batch">
<span class="sig-name descname"><span class="pre">next_batch</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">batch_size</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.GATuner.next_batch" title="永久链接至目标">¶</a></dt>
<dd><p>get the next batch of configs to be measure on real hardware</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>batch_size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – The size of the batch</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p></p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>a batch of configs</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.GATuner.update">
<span class="sig-name descname"><span class="pre">update</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">inputs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">results</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.GATuner.update" title="永久链接至目标">¶</a></dt>
<dd><p>Update parameters of the tuner according to measurement results</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>inputs</strong> (<em>Array of autotvm.measure.MeasureInput</em>) – The input for measurement</p></li>
<li><p><strong>results</strong> (<em>Array of autotvm.measure.MeasureResult</em>) – result for measurement</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.GATuner.has_next">
<span class="sig-name descname"><span class="pre">has_next</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.GATuner.has_next" title="永久链接至目标">¶</a></dt>
<dd><p>Whether has next untried config in the space</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>has_next</strong></p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)">bool</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.GATuner.reset">
<span class="sig-name descname"><span class="pre">reset</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.GATuner.reset" title="永久链接至目标">¶</a></dt>
<dd><p>reset the status of tuner</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.GATuner.tune">
<span class="sig-name descname"><span class="pre">tune</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n_trial</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">measure_option</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">early_stopping</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">callbacks</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">()</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">si_prefix</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'G'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.GATuner.tune" title="永久链接至目标">¶</a></dt>
<dd><p>Begin tuning</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>n_trial</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – Maximum number of configs to try (measure on real hardware)</p></li>
<li><p><strong>measure_option</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(在 Python v3.10)"><em>dict</em></a>) – The options for how to measure generated code.
You should use the return value ot autotvm.measure_option for this argument.</p></li>
<li><p><strong>early_stopping</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a><em>, </em><em>optional</em>) – Early stop the tuning when not finding better configs in this number of trials</p></li>
<li><p><strong>callbacks</strong> (<em>List of callable</em>) – A list of callback functions. The signature of callback function is
(Tuner, List of MeasureInput, List of MeasureResult)
with no return value. These callback functions will be called on
every measurement pair. See autotvm/tuner/callback.py for some examples.</p></li>
<li><p><strong>si_prefix</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – One of tvm.autotvm.utils.SI_PREFIXES. The SI prefix to use when reporting FLOPS.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.GATuner.load_history">
<span class="sig-name descname"><span class="pre">load_history</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data_set</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">min_seed_records</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">500</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.GATuner.load_history" title="永久链接至目标">¶</a></dt>
<dd><p>load history data for transfer learning</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>data_set</strong> (<em>Array of</em><em> (</em><a class="reference internal" href="#tvm.autotvm.measure.MeasureInput" title="tvm.autotvm.measure.MeasureInput"><em>autotvm.measure.MeasureInput</em></a><em>, </em><a class="reference internal" href="#tvm.autotvm.measure.MeasureResult" title="tvm.autotvm.measure.MeasureResult"><em>autotvm.measure.MeasureResult</em></a><em>) </em><em>pair</em>) – Previous tuning records</p></li>
<li><p><strong>min_seed_records</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – Defaults to 500. Indicates the minimum number of records to
train the tuner with. If there are less than <cite>min_seed_records</cite>
number of records in <cite>data_set</cite>, no training of the tuner
will be done.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.XGBTuner">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.tuner.</span></span><span class="sig-name descname"><span class="pre">XGBTuner</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">task</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">plan_size</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">64</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">feature_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'itervar'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">loss_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'rank'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">num_threads</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">optimizer</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'sa'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">diversity_filter_ratio</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">log_interval</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">50</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.XGBTuner" title="永久链接至目标">¶</a></dt>
<dd><p>Tuner that uses xgboost as cost model</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>task</strong> (<a class="reference internal" href="#tvm.autotvm.task.task.Task" title="tvm.autotvm.task.task.Task"><em>Task</em></a>) – The tuning task</p></li>
<li><p><strong>plan_size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – The size of a plan. After <cite>plan_size</cite> trials, the tuner will refit a new cost model
and do planing for the next <cite>plan_size</cite> trials.</p></li>
<li><p><strong>feature_type</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>, </em><em>optional</em>) – <p>If is ‘itervar’, use features extracted from IterVar (loop variable).
If is ‘knob’, use flatten ConfigEntity directly.
If is ‘curve’, use sampled curve feature (relation feature).</p>
<p>Note on choosing feature type:
For single task tuning, ‘itervar’ and ‘knob’ are good.
‘itervar’ is more accurate but ‘knob’ is much faster.
There are some constraints on ‘itervar’, if you meet
problems with feature extraction when using ‘itervar’,
you can switch to ‘knob’.</p>
<p>For cross-shape tuning (e.g. many convolutions with different shapes),
‘itervar’ and ‘curve’ has better transferability,
‘knob’ is faster.</p>
<p>For cross-device or cross-operator tuning, you can use ‘curve’ only.</p>
</p></li>
<li><p><strong>loss_type</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – If is ‘reg’, use regression loss to train cost model.
The cost model predicts the normalized flops.
If is ‘rank’, use pairwise rank loss to train cost model.
The cost model predicts relative rank score.</p></li>
<li><p><strong>num_threads</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a><em>, </em><em>optional</em>) – The number of threads.</p></li>
<li><p><strong>optimizer</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em> or </em><em>ModelOptimizer</em><em>, </em><em>optional</em>) – If is ‘sa’, use a default simulated annealing optimizer.
Otherwise it should be a ModelOptimizer object.</p></li>
<li><p><strong>diversity_filter_ratio</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a><em> or </em><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(在 Python v3.10)"><em>float</em></a><em>, </em><em>optional</em>) – If is not None, the tuner will first select
top-(plan_size * diversity_filter_ratio) candidates according to the cost model
and then pick batch_size of them according to the diversity metric.</p></li>
<li><p><strong>log_interval</strong> (<em>int = 50</em>) – The verbose level.
If is 0, output nothing.
Otherwise, output debug information every <cite>verbose</cite> iterations.</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.XGBTuner.tune">
<span class="sig-name descname"><span class="pre">tune</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.XGBTuner.tune" title="永久链接至目标">¶</a></dt>
<dd><p>Begin tuning</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>n_trial</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – Maximum number of configs to try (measure on real hardware)</p></li>
<li><p><strong>measure_option</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(在 Python v3.10)"><em>dict</em></a>) – The options for how to measure generated code.
You should use the return value ot autotvm.measure_option for this argument.</p></li>
<li><p><strong>early_stopping</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a><em>, </em><em>optional</em>) – Early stop the tuning when not finding better configs in this number of trials</p></li>
<li><p><strong>callbacks</strong> (<em>List of callable</em>) – A list of callback functions. The signature of callback function is
(Tuner, List of MeasureInput, List of MeasureResult)
with no return value. These callback functions will be called on
every measurement pair. See autotvm/tuner/callback.py for some examples.</p></li>
<li><p><strong>si_prefix</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – One of tvm.autotvm.utils.SI_PREFIXES. The SI prefix to use when reporting FLOPS.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.XGBTuner.has_next">
<span class="sig-name descname"><span class="pre">has_next</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.XGBTuner.has_next" title="永久链接至目标">¶</a></dt>
<dd><p>Whether has next untried config in the space</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>has_next</strong></p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)">bool</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.XGBTuner.load_history">
<span class="sig-name descname"><span class="pre">load_history</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data_set</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">min_seed_records</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">500</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.XGBTuner.load_history" title="永久链接至目标">¶</a></dt>
<dd><p>load history data for transfer learning</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>data_set</strong> (<em>Array of</em><em> (</em><a class="reference internal" href="#tvm.autotvm.measure.MeasureInput" title="tvm.autotvm.measure.MeasureInput"><em>autotvm.measure.MeasureInput</em></a><em>, </em><a class="reference internal" href="#tvm.autotvm.measure.MeasureResult" title="tvm.autotvm.measure.MeasureResult"><em>autotvm.measure.MeasureResult</em></a><em>) </em><em>pair</em>) – Previous tuning records</p></li>
<li><p><strong>min_seed_records</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – Defaults to 500. Indicates the minimum number of records to
train the tuner with. If there are less than <cite>min_seed_records</cite>
number of records in <cite>data_set</cite>, no training of the tuner
will be done.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.XGBTuner.next_batch">
<span class="sig-name descname"><span class="pre">next_batch</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">batch_size</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.XGBTuner.next_batch" title="永久链接至目标">¶</a></dt>
<dd><p>get the next batch of configs to be measure on real hardware</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>batch_size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – The size of the batch</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p></p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>a batch of configs</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.XGBTuner.reset">
<span class="sig-name descname"><span class="pre">reset</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.XGBTuner.reset" title="永久链接至目标">¶</a></dt>
<dd><p>reset the status of tuner</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.XGBTuner.update">
<span class="sig-name descname"><span class="pre">update</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">inputs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">results</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.XGBTuner.update" title="永久链接至目标">¶</a></dt>
<dd><p>Update parameters of the tuner according to measurement results</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>inputs</strong> (<em>Array of autotvm.measure.MeasureInput</em>) – The input for measurement</p></li>
<li><p><strong>results</strong> (<em>Array of autotvm.measure.MeasureResult</em>) – result for measurement</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</dd></dl>

<span class="target" id="module-tvm.autotvm.tuner.callback"></span><p>Namespace of callback utilities of AutoTVM</p>
<dl class="py function">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.callback.log_to_file">
<span class="sig-prename descclassname"><span class="pre">tvm.autotvm.tuner.callback.</span></span><span class="sig-name descname"><span class="pre">log_to_file</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">file_out</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">protocol</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'json'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.callback.log_to_file" title="永久链接至目标">¶</a></dt>
<dd><p>Log the tuning records into file.
The rows of the log are stored in the format of autotvm.record.encode.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>file_out</strong> (<em>File</em><em> or </em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The file to log to.</p></li>
<li><p><strong>protocol</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em>, </em><em>optional</em>) – The log protocol. Can be ‘json’ or ‘pickle’</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>callback</strong> – Callback function to do the logging.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>callable</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.callback.log_to_database">
<span class="sig-prename descclassname"><span class="pre">tvm.autotvm.tuner.callback.</span></span><span class="sig-name descname"><span class="pre">log_to_database</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">db</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.callback.log_to_database" title="永久链接至目标">¶</a></dt>
<dd><p>Save the tuning records to a database object.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>db</strong> (<em>Database</em>) – The database</p>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.callback.Monitor">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.tuner.callback.</span></span><span class="sig-name descname"><span class="pre">Monitor</span></span><a class="headerlink" href="#tvm.autotvm.tuner.callback.Monitor" title="永久链接至目标">¶</a></dt>
<dd><p>A monitor to collect statistic during tuning</p>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.callback.Monitor.trial_scores">
<span class="sig-name descname"><span class="pre">trial_scores</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.callback.Monitor.trial_scores" title="永久链接至目标">¶</a></dt>
<dd><p>get scores (currently is flops) of all trials</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.callback.Monitor.trial_timestamps">
<span class="sig-name descname"><span class="pre">trial_timestamps</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.callback.Monitor.trial_timestamps" title="永久链接至目标">¶</a></dt>
<dd><p>get wall clock time stamp of all trials</p>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.autotvm.tuner.callback.progress_bar">
<span class="sig-prename descclassname"><span class="pre">tvm.autotvm.tuner.callback.</span></span><span class="sig-name descname"><span class="pre">progress_bar</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">total</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prefix</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">si_prefix</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'G'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.tuner.callback.progress_bar" title="永久链接至目标">¶</a></dt>
<dd><p>Display progress bar for tuning</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>total</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – The total number of trials</p></li>
<li><p><strong>prefix</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The prefix of output message</p></li>
<li><p><strong>si_prefix</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – SI prefix for flops</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-tvm.autotvm.task">
<span id="tvm-autotvm-task"></span><h2>tvm.autotvm.task<a class="headerlink" href="#module-tvm.autotvm.task" title="永久链接至标题">¶</a></h2>
<p>Task is a tunable composition of template functions.</p>
<p>Tuner takes a tunable task and optimizes the joint configuration
space of all the template functions in the task.
This module defines the task data structure, as well as a collection(zoo)
of typical tasks of interest.</p>
<span class="target" id="module-tvm.autotvm.task.task"></span><p>Definition of task function.</p>
<p>Task can be constructed from tuple of func, args, and kwargs.
func is a state-less function, or a string that
registers the standard task.</p>
<dl class="py function">
<dt class="sig sig-object py" id="tvm.autotvm.task.task.serialize_args">
<span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.task.</span></span><span class="sig-name descname"><span class="pre">serialize_args</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.task.serialize_args" title="永久链接至目标">¶</a></dt>
<dd><p>serialize arguments of a topi function to a hashable tuple.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>args</strong> (<em>list of hashable</em><em> or </em><a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>Tensor</em></a>) – </p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.autotvm.task.task.deserialize_args">
<span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.task.</span></span><span class="sig-name descname"><span class="pre">deserialize_args</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.task.deserialize_args" title="永久链接至目标">¶</a></dt>
<dd><p>The inverse function of <code class="code docutils literal notranslate"><span class="pre">serialize_args</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>args</strong> (<em>list of hashable</em><em> or </em><a class="reference internal" href="te.html#tvm.te.Tensor" title="tvm.te.Tensor"><em>Tensor</em></a>) – </p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.autotvm.task.task.args_to_workload">
<span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.task.</span></span><span class="sig-name descname"><span class="pre">args_to_workload</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">task_name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.task.args_to_workload" title="永久链接至目标">¶</a></dt>
<dd><p>Convert argument list to hashable workload tuple.
This function will convert list to tuple, tvm node to python value and
flatten te.tensor.Tensor to a tuple</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>task_name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The AutoTVM task name</p></li>
<li><p><strong>args</strong> (<em>list of args</em>) – The arguments to the function</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>ret</strong> – The hashable value</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>hashable</p>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.task.task.Task">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.task.</span></span><span class="sig-name descname"><span class="pre">Task</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.task.Task" title="永久链接至目标">¶</a></dt>
<dd><p>A Tunable Task</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The name of the task.</p></li>
<li><p><strong>args</strong> (<em>Tuple</em>) – Positional argument of func</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.task.Task.instantiate">
<span class="sig-name descname"><span class="pre">instantiate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">config</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.task.Task.instantiate" title="永久链接至目标">¶</a></dt>
<dd><p>Instantiate this task function (template) with a config.
Returns corresponding schedule.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>config</strong> (<em>template.ConfigEntity</em>) – parameter config for this template</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p><strong>sch</strong> (<em>tvm.te.schedule.Schedule</em>) – The tvm schedule</p></li>
<li><p><strong>arg_bufs</strong> (<em>Array of te.tensor.Tensor</em>) – The input/output buffers</p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.task.task.TaskTemplate">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.task.</span></span><span class="sig-name descname"><span class="pre">TaskTemplate</span></span><a class="headerlink" href="#tvm.autotvm.task.task.TaskTemplate" title="永久链接至目标">¶</a></dt>
<dd><p>Task template is used to creates a tunable AutoTVM task.</p>
<p>It can be defined by a pair of compute and schedule function using
<cite>_register_task_compute</cite> and <cite>_register_task_schedule</cite>,
or by a customized task creation function that is more flexible using
<cite>_register_customized_task</cite>.</p>
<p>Note that when customized func is registered, compute and schedule function
will be ignored</p>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.task.task.MissingTask">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.task.</span></span><span class="sig-name descname"><span class="pre">MissingTask</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">taskname</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.task.MissingTask" title="永久链接至目标">¶</a></dt>
<dd><p>Dummy task template for a task lookup which cannot be resolved.
This can occur if the task being requested from _lookup_task()
has not been imported in this run.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.autotvm.task.task.template">
<span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.task.</span></span><span class="sig-name descname"><span class="pre">template</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">task_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">func</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.task.template" title="永久链接至目标">¶</a></dt>
<dd><p>Decorate a function as a tunable schedule template.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>task_name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The task name</p></li>
<li><p><strong>func</strong> (<a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(在 Python v3.10)"><em>None</em></a><em> or </em><em>callable</em>) – A callable template function.
If it is None, return a decorator.
If is callable, decorate this function.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>func</strong> – The decorated function</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>callable</p>
</dd>
</dl>
<p class="rubric">实际案例</p>
<p>The following code is a tunable template for a blocked matrix multiplication</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="nd">@autotvm.template</span><span class="p">(</span><span class="s2">&quot;matmul&quot;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">matmul</span><span class="p">(</span><span class="n">N</span><span class="p">,</span> <span class="n">L</span><span class="p">,</span> <span class="n">M</span><span class="p">,</span> <span class="n">dtype</span><span class="p">):</span>
    <span class="n">A</span> <span class="o">=</span> <span class="n">te</span><span class="o">.</span><span class="n">placeholder</span><span class="p">((</span><span class="n">N</span><span class="p">,</span> <span class="n">L</span><span class="p">),</span> <span class="n">name</span><span class="o">=</span><span class="s1">&#39;A&#39;</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="n">dtype</span><span class="p">)</span>
    <span class="n">B</span> <span class="o">=</span> <span class="n">te</span><span class="o">.</span><span class="n">placeholder</span><span class="p">((</span><span class="n">L</span><span class="p">,</span> <span class="n">M</span><span class="p">),</span> <span class="n">name</span><span class="o">=</span><span class="s1">&#39;B&#39;</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="n">dtype</span><span class="p">)</span>

    <span class="n">k</span> <span class="o">=</span> <span class="n">te</span><span class="o">.</span><span class="n">reduce_axis</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="n">L</span><span class="p">),</span> <span class="n">name</span><span class="o">=</span><span class="s1">&#39;k&#39;</span><span class="p">)</span>
    <span class="n">C</span> <span class="o">=</span> <span class="n">te</span><span class="o">.</span><span class="n">compute</span><span class="p">((</span><span class="n">N</span><span class="p">,</span> <span class="n">M</span><span class="p">),</span> <span class="k">lambda</span> <span class="n">i</span><span class="p">,</span> <span class="n">j</span><span class="p">:</span> <span class="n">te</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">A</span><span class="p">[</span><span class="n">i</span><span class="p">,</span> <span class="n">k</span><span class="p">]</span> <span class="o">*</span> <span class="n">B</span><span class="p">[</span><span class="n">k</span><span class="p">,</span> <span class="n">j</span><span class="p">],</span> <span class="n">axis</span><span class="o">=</span><span class="n">k</span><span class="p">),</span> <span class="n">name</span><span class="o">=</span><span class="s1">&#39;C&#39;</span><span class="p">)</span>
    <span class="n">s</span> <span class="o">=</span> <span class="n">te</span><span class="o">.</span><span class="n">create_schedule</span><span class="p">(</span><span class="n">C</span><span class="o">.</span><span class="n">op</span><span class="p">)</span>

    <span class="c1"># schedule</span>
    <span class="n">y</span><span class="p">,</span> <span class="n">x</span> <span class="o">=</span> <span class="n">s</span><span class="p">[</span><span class="n">C</span><span class="p">]</span><span class="o">.</span><span class="n">op</span><span class="o">.</span><span class="n">axis</span>
    <span class="n">k</span> <span class="o">=</span> <span class="n">s</span><span class="p">[</span><span class="n">C</span><span class="p">]</span><span class="o">.</span><span class="n">op</span><span class="o">.</span><span class="n">reduce_axis</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>

    <span class="c1">##### define space begin #####</span>
    <span class="n">cfg</span> <span class="o">=</span> <span class="n">autotvm</span><span class="o">.</span><span class="n">get_config</span><span class="p">()</span>
    <span class="n">cfg</span><span class="o">.</span><span class="n">define_split</span><span class="p">(</span><span class="s2">&quot;tile_y&quot;</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">num_outputs</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
    <span class="n">cfg</span><span class="o">.</span><span class="n">define_split</span><span class="p">(</span><span class="s2">&quot;tile_x&quot;</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">num_outputs</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
    <span class="c1">##### define space end #####</span>

    <span class="c1"># schedule according to config</span>
    <span class="n">yo</span><span class="p">,</span> <span class="n">yi</span> <span class="o">=</span> <span class="n">cfg</span><span class="p">[</span><span class="s2">&quot;tile_y&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">apply</span><span class="p">(</span><span class="n">s</span><span class="p">,</span> <span class="n">C</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
    <span class="n">xo</span><span class="p">,</span> <span class="n">xi</span> <span class="o">=</span> <span class="n">cfg</span><span class="p">[</span><span class="s2">&quot;tile_x&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">apply</span><span class="p">(</span><span class="n">s</span><span class="p">,</span> <span class="n">C</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span>

    <span class="n">s</span><span class="p">[</span><span class="n">C</span><span class="p">]</span><span class="o">.</span><span class="n">reorder</span><span class="p">(</span><span class="n">yo</span><span class="p">,</span> <span class="n">xo</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">yi</span><span class="p">,</span> <span class="n">xi</span><span class="p">)</span>

    <span class="k">return</span> <span class="n">s</span><span class="p">,</span> <span class="p">[</span><span class="n">A</span><span class="p">,</span> <span class="n">B</span><span class="p">,</span> <span class="n">C</span><span class="p">]</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.autotvm.task.task.create">
<span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.task.</span></span><span class="sig-name descname"><span class="pre">create</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">task_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">target</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">target_host</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.task.create" title="永久链接至目标">¶</a></dt>
<dd><p>Create a tuning task and initialize its search space</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>task_name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The AutoTVM task name</p></li>
<li><p><strong>args</strong> (<a class="reference internal" href="relay/dataflow_pattern.html#tvm.relay.dataflow_pattern.List" title="tvm.relay.dataflow_pattern.List"><em>List</em></a>) – Positional arguments</p></li>
<li><p><strong>target</strong> (<a class="reference internal" href="target.html#tvm.target.Target" title="tvm.target.Target"><em>Target</em></a>) – The compilation target</p></li>
<li><p><strong>target_host</strong> (<a class="reference internal" href="target.html#tvm.target.Target" title="tvm.target.Target"><em>Target</em></a><em>, </em><em>optional</em>) – The compilation target for host side</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>tsk</strong> – a task object</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.autotvm.task.task.Task" title="tvm.autotvm.task.task.Task">Task</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.autotvm.task.task.get_config">
<span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.task.</span></span><span class="sig-name descname"><span class="pre">get_config</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.task.get_config" title="永久链接至目标">¶</a></dt>
<dd><p>Get current config object</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>cfg</strong> – The current config</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference internal" href="#tvm.autotvm.task.space.ConfigSpace" title="tvm.autotvm.task.space.ConfigSpace">ConfigSpace</a> or <a class="reference internal" href="#tvm.autotvm.task.space.ConfigEntity" title="tvm.autotvm.task.space.ConfigEntity">ConfigEntity</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py exception">
<dt class="sig sig-object py" id="tvm.autotvm.task.task.FlopCalculationError">
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.task.</span></span><span class="sig-name descname"><span class="pre">FlopCalculationError</span></span><a class="headerlink" href="#tvm.autotvm.task.task.FlopCalculationError" title="永久链接至目标">¶</a></dt>
<dd><p>Error happens when estimating FLOP for a compute op</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.autotvm.task.task.compute_flop">
<span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.task.</span></span><span class="sig-name descname"><span class="pre">compute_flop</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sch</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.task.compute_flop" title="永久链接至目标">¶</a></dt>
<dd><p>Calculate number of FLOP (floating number operations) of the compute ops in a schedule</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>sch</strong> (<a class="reference internal" href="te.html#tvm.te.Schedule" title="tvm.te.schedule.Schedule"><em>tvm.te.schedule.Schedule</em></a>) – schedule</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>flop</strong> – number of FLOP in this schedule</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)">int</a></p>
</dd>
</dl>
</dd></dl>

<span class="target" id="module-tvm.autotvm.task.space"></span><p>Template configuration space.</p>
<p>Each template function can be parameterized by a ConfigSpace.
The space is declared when we invoke the template function with ConfigSpace.
During evaluation, we pass in a ConfigEntity, which contains a specific
entity in the space. This entity contains deterministic parameters.</p>
<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.Axis">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.space.</span></span><span class="sig-name descname"><span class="pre">Axis</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">space</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">index</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.Axis" title="永久链接至目标">¶</a></dt>
<dd><dl class="py property">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.Axis.index">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">index</span></span><a class="headerlink" href="#tvm.autotvm.task.space.Axis.index" title="永久链接至目标">¶</a></dt>
<dd><p>Alias for field number 1</p>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.Axis.space">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">space</span></span><a class="headerlink" href="#tvm.autotvm.task.space.Axis.space" title="永久链接至目标">¶</a></dt>
<dd><p>Alias for field number 0</p>
</dd></dl>

</dd></dl>

<dl class="py exception">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.InstantiationError">
<em class="property"><span class="pre">exception</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.space.</span></span><span class="sig-name descname"><span class="pre">InstantiationError</span></span><a class="headerlink" href="#tvm.autotvm.task.space.InstantiationError" title="永久链接至目标">¶</a></dt>
<dd><p>Actively detected error in instantiating a template with a config,
raised by cfg.raise_error
e.g. too many unrolling, too many threads in a block</p>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.TransformSpace">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.space.</span></span><span class="sig-name descname"><span class="pre">TransformSpace</span></span><a class="headerlink" href="#tvm.autotvm.task.space.TransformSpace" title="永久链接至目标">¶</a></dt>
<dd><p>Base class for transform space
TransformSpace is the node in the computation graph of axes</p>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>We can regard our schedule code as a transformation graph of axes.
Starting from raw axes in the definition of te.compute, we can transform these axes
by some operators. The operator includes ‘split’, ‘reorder’ and ‘annotate’.
Each operator has some tunable parameters (e.g. the split factor).
Then the tuning process is just to find good parameters of these op.</p>
</div>
<p>So all the combinations of the parameters of these op form our search space.</p>
<p>Naming convention:
We call the set of all possible values as XXXSpace. (XXX can be Split, Reorder, Config …)
We call a specific entity in a space as XXXEntity.</p>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.TransformSpace.get_num_output">
<em class="property"><span class="pre">static</span> </em><span class="sig-name descname"><span class="pre">get_num_output</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.TransformSpace.get_num_output" title="永久链接至目标">¶</a></dt>
<dd><p>get number of output axes after this transform</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>n</strong> – number of output axes</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)">int</a></p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.VirtualAxis">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.space.</span></span><span class="sig-name descname"><span class="pre">VirtualAxis</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">var</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.VirtualAxis" title="永久链接至目标">¶</a></dt>
<dd><p>Axis placeholder in template</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>var</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a><em> or </em><em>tvm.te.schedule.IterVar</em>) – If is int, return a virtual axis whose length is the provided argument.
If is IterVar, return a virtual axis whose length is extracted from
the IterVar’s extent domain.</p></li>
<li><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – </p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.VirtualAxis.get_num_output">
<em class="property"><span class="pre">static</span> </em><span class="sig-name descname"><span class="pre">get_num_output</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">var</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.VirtualAxis.get_num_output" title="永久链接至目标">¶</a></dt>
<dd><p>get number of output axes after this transform</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>n</strong> – number of output axes</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)">int</a></p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.get_factors">
<span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.space.</span></span><span class="sig-name descname"><span class="pre">get_factors</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.get_factors" title="永久链接至目标">¶</a></dt>
<dd><p>return all factors of an integer</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>n</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – integer to factorize</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>factors</strong> – List of all factors</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(在 Python v3.10)">list</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.get_pow2s">
<span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.space.</span></span><span class="sig-name descname"><span class="pre">get_pow2s</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.get_pow2s" title="永久链接至目标">¶</a></dt>
<dd><p>return all power-of-two numbers that are less or equal than the integer</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>n</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – integer for reference</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>factors</strong> – List of all power-of-two numbers</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(在 Python v3.10)">list</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.SplitSpace">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.space.</span></span><span class="sig-name descname"><span class="pre">SplitSpace</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">axes</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">policy</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.SplitSpace" title="永久链接至目标">¶</a></dt>
<dd><p>Split an axis for several times</p>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.SplitSpace.get_num_output">
<em class="property"><span class="pre">static</span> </em><span class="sig-name descname"><span class="pre">get_num_output</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">axes</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">policy</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.SplitSpace.get_num_output" title="永久链接至目标">¶</a></dt>
<dd><p>get number of output axes after this transform</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>n</strong> – number of output axes</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)">int</a></p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.SplitEntity">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.space.</span></span><span class="sig-name descname"><span class="pre">SplitEntity</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">size</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.SplitEntity" title="永久链接至目标">¶</a></dt>
<dd><p>A split operation with detailed parameters
that can apply to an axis</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>size</strong> (<em>Array of int</em>) – the size of every axis after split.
e.g. an axis of extent 128, we split it into 3 axes, a possible
size is [4, 4, 8] (4x4x8 = 128).</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.SplitEntity.apply">
<span class="sig-name descname"><span class="pre">apply</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sch</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">op</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">axis</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.SplitEntity.apply" title="永久链接至目标">¶</a></dt>
<dd><p>Apply split to an axis</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>sch</strong> (<a class="reference internal" href="te.html#tvm.te.Schedule" title="tvm.te.schedule.Schedule"><em>tvm.te.schedule.Schedule</em></a>) – The tvm schedule</p></li>
<li><p><strong>op</strong> (<em>tvm.te.Operation</em>) – The stage to be applied</p></li>
<li><p><strong>axis</strong> (<em>tvm.te.schedule.IterVar</em>) – axis to split</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>axes</strong> – The transformed axes.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>list of Axis</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.ReorderSpace">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.space.</span></span><span class="sig-name descname"><span class="pre">ReorderSpace</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">axes</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">policy</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.ReorderSpace" title="永久链接至目标">¶</a></dt>
<dd><p>The parameter space for ordering an array of axes</p>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.ReorderSpace.get_num_output">
<em class="property"><span class="pre">static</span> </em><span class="sig-name descname"><span class="pre">get_num_output</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">axes</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">policy</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.ReorderSpace.get_num_output" title="永久链接至目标">¶</a></dt>
<dd><p>get number of output axes after this transform</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>n</strong> – number of output axes</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)">int</a></p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.ReorderEntity">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.space.</span></span><span class="sig-name descname"><span class="pre">ReorderEntity</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">perm</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.ReorderEntity" title="永久链接至目标">¶</a></dt>
<dd><p>A reorder operation with detailed parameters that can apply to axes</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>perm</strong> (<em>Array of int</em>) – define the permutation</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.ReorderEntity.apply">
<span class="sig-name descname"><span class="pre">apply</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sch</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">op</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">axes</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.ReorderEntity.apply" title="永久链接至目标">¶</a></dt>
<dd><p>Apply reorder to an array of axes</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>sch</strong> (<a class="reference internal" href="te.html#tvm.te.Schedule" title="tvm.te.schedule.Schedule"><em>tvm.te.schedule.Schedule</em></a>) – The tvm schedule</p></li>
<li><p><strong>op</strong> (<em>tvm.te.Operation</em>) – The stage to be applied</p></li>
<li><p><strong>axis</strong> (<em>tvm.te.schedule.IterVar</em>) – axis to split</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>axes</strong> – The transformed axes.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>list of Axis</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.AnnotateSpace">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.space.</span></span><span class="sig-name descname"><span class="pre">AnnotateSpace</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">axes</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">policy</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.AnnotateSpace" title="永久链接至目标">¶</a></dt>
<dd><p>The parameter space for annotating an array of axes</p>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.AnnotateSpace.get_num_output">
<em class="property"><span class="pre">static</span> </em><span class="sig-name descname"><span class="pre">get_num_output</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">axes</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">policy</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.AnnotateSpace.get_num_output" title="永久链接至目标">¶</a></dt>
<dd><p>get number of output axes after this transform</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>n</strong> – number of output axes</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)">int</a></p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.AnnotateEntity">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.space.</span></span><span class="sig-name descname"><span class="pre">AnnotateEntity</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">anns</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.AnnotateEntity" title="永久链接至目标">¶</a></dt>
<dd><p>An annotation operation with detailed parameters that can apply to axes</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>anns</strong> (<em>Array of string</em>) – The annotations of axes</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.AnnotateEntity.apply">
<span class="sig-name descname"><span class="pre">apply</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sch</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">op</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">axes</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">axis_lens</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">max_unroll</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">vec_size</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cfg</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">source</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.AnnotateEntity.apply" title="永久链接至目标">¶</a></dt>
<dd><p>Apply annotation to an array of axes</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>sch</strong> (<a class="reference internal" href="te.html#tvm.te.Schedule" title="tvm.te.schedule.Schedule"><em>tvm.te.schedule.Schedule</em></a>) – The tvm schedule</p></li>
<li><p><strong>op</strong> (<em>tvm.te.Operation</em>) – The stage to be applied</p></li>
<li><p><strong>axes</strong> (<em>Array of tvm.te.schedule.IterVar</em>) – axis to split</p></li>
<li><p><strong>axis_lens</strong> (<em>Array of int</em><em>, </em><em>optional</em>) – the length of axes</p></li>
<li><p><strong>max_unroll</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a><em>, </em><em>optional</em>) – maximum unroll step</p></li>
<li><p><strong>vec_size</strong> (<em>Array of int</em><em>, </em><em>optional</em>) – valid vector lanes for vectorization</p></li>
<li><p><strong>cfg</strong> (<a class="reference internal" href="#tvm.autotvm.task.space.ConfigEntity" title="tvm.autotvm.task.space.ConfigEntity"><em>ConfigEntity</em></a><em>, </em><em>optional</em>) – cfg for recording error</p></li>
<li><p><strong>source</strong> (<em>Array of Array tensor</em><em>, </em><em>optional</em>) – source tensor for attaching cache</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>axes</strong> – The transformed axes</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>list of tvm.te.schedule.IterVar</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.OtherOptionSpace">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.space.</span></span><span class="sig-name descname"><span class="pre">OtherOptionSpace</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">axes</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">policy</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.OtherOptionSpace" title="永久链接至目标">¶</a></dt>
<dd><p>The parameter space for general option</p>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.OtherOptionSpace.get_num_output">
<em class="property"><span class="pre">static</span> </em><span class="sig-name descname"><span class="pre">get_num_output</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">axes</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">policy</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.OtherOptionSpace.get_num_output" title="永久链接至目标">¶</a></dt>
<dd><p>get number of output axes after this transform</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>n</strong> – number of output axes</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)">int</a></p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.OtherOptionEntity">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.space.</span></span><span class="sig-name descname"><span class="pre">OtherOptionEntity</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">val</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.OtherOptionEntity" title="永久链接至目标">¶</a></dt>
<dd><p>The parameter entity for general option, with a detailed value</p>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.ConfigSpace">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.space.</span></span><span class="sig-name descname"><span class="pre">ConfigSpace</span></span><a class="headerlink" href="#tvm.autotvm.task.space.ConfigSpace" title="永久链接至目标">¶</a></dt>
<dd><p>The configuration space of a schedule. Pass it as config in template to
collect transformation space and build transform graph of axes</p>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.ConfigSpace.axis">
<em class="property"><span class="pre">static</span> </em><span class="sig-name descname"><span class="pre">axis</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">var</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.ConfigSpace.axis" title="永久链接至目标">¶</a></dt>
<dd><p>get a virtual axis (axis placeholder)</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>var</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a><em> or </em><em>tvm.te.schedule.IterVar</em>) – If is int, return an axis whose length is the provided argument.
If is IterVar, return an axis whose length is extracted from the
IterVar’s extent domain.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.ConfigSpace.reduce_axis">
<em class="property"><span class="pre">static</span> </em><span class="sig-name descname"><span class="pre">reduce_axis</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">var</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.ConfigSpace.reduce_axis" title="永久链接至目标">¶</a></dt>
<dd><p>get a virtual axis (axis placeholder)</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>var</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a><em> or </em><em>tvm.te.schedule.IterVar</em>) – If is int, return an axis whose length is the provided argument.
If is IterVar, return an axis whose length is extracted from the
IterVar’s extent domain.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.ConfigSpace.define_split">
<span class="sig-name descname"><span class="pre">define_split</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">axis</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">policy</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'factors'</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.ConfigSpace.define_split" title="永久链接至目标">¶</a></dt>
<dd><p>Define a new tunable knob which splits an axis into a list of axes</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – name to index the entity of this space</p></li>
<li><p><strong>axis</strong> (<em>tvm.te.schedule.IterVar</em>) – axis to split</p></li>
<li><p><strong>policy</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – name of policy.
If is ‘factors’, the tuner will try all divisible factors.
If is ‘power2’, the tuner will try power-of-two factors less or equal to the length.
If is ‘verbose’, the tuner will try all candidates in above two policies.
If is ‘candidate’, try given candidates.</p></li>
<li><p><strong>**kwargs</strong> – <p>extra arguments for policy</p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">max_factor</span></code>:</dt><dd><p>the maximum split factor (<cite>int</cite>).</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">filter</span></code>:</dt><dd><p>see examples below for how to use filter (<cite>Callable[[int], bool]</cite>).</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">num_outputs</span></code>:</dt><dd><p>the total number of axis after split (<cite>int</cite>).</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">no_tail</span></code>:</dt><dd><p>should we only include divisible numbers as split factors (<cite>bool</cite>).</p>
</dd>
<dt><cite>candidate`</cite>:</dt><dd><p>(policy=candidate) manual candidate list (<cite>List</cite>).</p>
</dd>
</dl>
</p></li>
</ul>
</dd>
</dl>
<p class="rubric">实际案例</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="c1"># use custom candidates</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">cfg</span><span class="o">.</span><span class="n">define_split</span><span class="p">(</span><span class="s1">&#39;tile_x&#39;</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">policy</span><span class="o">=</span><span class="s1">&#39;candidate&#39;</span><span class="p">,</span> <span class="n">candidate</span><span class="o">=</span><span class="p">[[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">4</span><span class="p">],</span> <span class="p">[</span><span class="mi">4</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">4</span><span class="p">]])</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="c1"># use a filter that only accepts the split scheme whose inner most tile is less then 4</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">cfg</span><span class="o">.</span><span class="n">define_split</span><span class="p">(</span><span class="s1">&#39;tile_y&#39;</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">policy</span><span class="o">=</span><span class="s1">&#39;factors&#39;</span><span class="p">,</span> <span class="nb">filter</span><span class="o">=</span><span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="n">x</span><span class="o">.</span><span class="n">size</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">&lt;=</span> <span class="mi">4</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.ConfigSpace.define_reorder">
<span class="sig-name descname"><span class="pre">define_reorder</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">axes</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">policy</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.ConfigSpace.define_reorder" title="永久链接至目标">¶</a></dt>
<dd><p>Define a new tunable knob which reorders a list of axes</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – name to index the entity of this space</p></li>
<li><p><strong>axes</strong> (<em>Array of tvm.te.schedule.IterVar</em>) – axes to reorder</p></li>
<li><p><strong>policy</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – name of policy
If is ‘identity’, do an identity permutation.
If is ‘all’, try all permutations.
If is ‘interval_all’, try all permutations of an interval of axes.
If is ‘candidate’, try listed candidate.
If is ‘interleave’, interleave chains of spatial axes and chains of reduction axes.</p></li>
<li><p><strong>kwargs</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(在 Python v3.10)"><em>dict</em></a>) – extra arguments for policy</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.ConfigSpace.define_annotate">
<span class="sig-name descname"><span class="pre">define_annotate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">axes</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">policy</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.ConfigSpace.define_annotate" title="永久链接至目标">¶</a></dt>
<dd><p>Define a new tunable knob which annotates a list of axes</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – name to index the entity of this space</p></li>
<li><p><strong>axes</strong> (<em>Array of tvm.te.schedule.IterVar</em>) – axes to annotate</p></li>
<li><p><strong>policy</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – name of policy
If is ‘unroll’, unroll the axes.
If is ‘try_unroll’, try to unroll the axes.
If is ‘try_unroll_vec’, try to unroll or vectorize the axes.
If is ‘bind_gpu’, bind the first few axes to gpu threads.
If is ‘locate_cache’, choose n axes to attach shared/local cache.</p></li>
<li><p><strong>kwargs</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(在 Python v3.10)"><em>dict</em></a>) – extra arguments for policy</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.ConfigSpace.define_knob">
<span class="sig-name descname"><span class="pre">define_knob</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">candidate</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.ConfigSpace.define_knob" title="永久链接至目标">¶</a></dt>
<dd><p>Define a tunable knob with a list of candidates</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – name key of that option</p></li>
<li><p><strong>candidate</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(在 Python v3.10)"><em>list</em></a>) – list of candidates</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.ConfigSpace.add_flop">
<span class="sig-name descname"><span class="pre">add_flop</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">flop</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.ConfigSpace.add_flop" title="永久链接至目标">¶</a></dt>
<dd><p>Add float operation statistics for this tuning task</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>flop</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a><em> or </em><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(在 Python v3.10)"><em>float</em></a><em> or </em><a class="reference internal" href="tir.html#tvm.tir.IntImm" title="tvm.tir.IntImm"><em>IntImm</em></a><em> or </em><a class="reference internal" href="tir.html#tvm.tir.FloatImm" title="tvm.tir.FloatImm"><em>FloatImm</em></a>) – number of float operations</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.ConfigSpace.raise_error">
<span class="sig-name descname"><span class="pre">raise_error</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.ConfigSpace.raise_error" title="永久链接至目标">¶</a></dt>
<dd><p>register error in config
Using this to actively detect error when scheduling.
Otherwise these error will occur during runtime, which
will cost more time.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>msg</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – </p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.ConfigSpace.valid">
<span class="sig-name descname"><span class="pre">valid</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.ConfigSpace.valid" title="永久链接至目标">¶</a></dt>
<dd><p>Check whether the config meets all the constraints</p>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>This check should be called after instantiation of task,
because the ConfigEntity/ConfigSpace collects errors during instantiation</p>
</div>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>valid</strong> – whether the config meets all the constraints</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)">bool</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.ConfigSpace.get">
<span class="sig-name descname"><span class="pre">get</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">index</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.ConfigSpace.get" title="永久链接至目标">¶</a></dt>
<dd><p>Get a config entity with detailed parameters from this space</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>index</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – index in the space</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.ConfigEntity">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.space.</span></span><span class="sig-name descname"><span class="pre">ConfigEntity</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">index</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">code_hash</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">entity_map</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">constraints</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.ConfigEntity" title="永久链接至目标">¶</a></dt>
<dd><p>A configuration with detailed parameters</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>index</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(在 Python v3.10)"><em>int</em></a>) – index of this config in space</p></li>
<li><p><strong>code_hash</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – hash of schedule code</p></li>
<li><p><strong>entity_map</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(在 Python v3.10)"><em>dict</em></a>) – map name to transform entity</p></li>
<li><p><strong>constraints</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(在 Python v3.10)"><em>list</em></a>) – List of constraints</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.ConfigEntity.get_flatten_feature">
<span class="sig-name descname"><span class="pre">get_flatten_feature</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.ConfigEntity.get_flatten_feature" title="永久链接至目标">¶</a></dt>
<dd><p>flatten entities to a numerical one-dimensional feature vector</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>fea</strong> – one dimensional float32 array</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p>np.array</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.ConfigEntity.get_other_option">
<span class="sig-name descname"><span class="pre">get_other_option</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.ConfigEntity.get_other_option" title="永久链接至目标">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>other_option</strong> – other tunable parameters (tunable parameters defined by <cite>cfg.define_knob</cite>)</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(在 Python v3.10)">dict</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.ConfigEntity.to_json_dict">
<span class="sig-name descname"><span class="pre">to_json_dict</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.ConfigEntity.to_json_dict" title="永久链接至目标">¶</a></dt>
<dd><p>convert to a json serializable dictionary</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>json_dict</strong> – a json serializable dictionary</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(在 Python v3.10)">dict</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.ConfigEntity.from_json_dict">
<em class="property"><span class="pre">static</span> </em><span class="sig-name descname"><span class="pre">from_json_dict</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">json_dict</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.ConfigEntity.from_json_dict" title="永久链接至目标">¶</a></dt>
<dd><p>Build a ConfigEntity from json serializable dictionary</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>json_dict</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(在 Python v3.10)"><em>dict</em></a>) – Json serializable dictionary. This should be the return value
of <a class="reference internal" href="#tvm.autotvm.task.space.ConfigEntity.to_json_dict" title="tvm.autotvm.task.space.ConfigEntity.to_json_dict"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">to_json_dict</span></code></a>.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>config</strong> – The corresponding config object</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.autotvm.task.space.ConfigEntity" title="tvm.autotvm.task.space.ConfigEntity">ConfigEntity</a></p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.FallbackConfigEntity">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.space.</span></span><span class="sig-name descname"><span class="pre">FallbackConfigEntity</span></span><a class="headerlink" href="#tvm.autotvm.task.space.FallbackConfigEntity" title="永久链接至目标">¶</a></dt>
<dd><p>The config entity created to support fallback</p>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.FallbackConfigEntity.fallback_split">
<span class="sig-name descname"><span class="pre">fallback_split</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">constraints</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.FallbackConfigEntity.fallback_split" title="永久链接至目标">¶</a></dt>
<dd><p>Fallback a split knob</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – name of the knob</p></li>
<li><p><strong>constraints</strong> (<em>List of int</em>) – The maximum tile size for every dimension. Value <cite>-1</cite> means no constraint.</p></li>
</ul>
</dd>
</dl>
<p class="rubric">实际案例</p>
<p>If you use cfg.define_split(‘tile_0’, 128, num_outputs=3),
Then cfg.fallback_split(‘tile_0’, [-1, 8, 4]) will give you cfg[‘tile_0’].size = [4, 8, 4]</p>
<p>If you use cfg.define_split(‘tile_0’, 49, num_outputs=3),
Then cfg.fallback_split(‘tile_0’, [-1, 8, 4]) will give you cfg[‘tile_0’].size = [7, 7, 1]</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.space.FallbackConfigEntity.fallback_with_reference_log">
<span class="sig-name descname"><span class="pre">fallback_with_reference_log</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ref_log</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.space.FallbackConfigEntity.fallback_with_reference_log" title="永久链接至目标">¶</a></dt>
<dd><p>A data driven fallback mechanism.
We use tuned parameters from TopHub as reference data.
For an unseen shape, we find the most similar tuned one from TopHub and
mimic its parameters.
Note that we are not matching by workload (e.g., input size, kernel size),
but instead matching by configuration space. The idea is that if two workloads have
similar configuration space, their optimal configurations are also likely to be similar.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>ref_log</strong> (<em>List of</em><em> (</em><a class="reference internal" href="#tvm.autotvm.measure.MeasureInput" title="tvm.autotvm.measure.MeasureInput"><em>autotvm.measure.MeasureInput</em></a><em>, </em><a class="reference internal" href="#tvm.autotvm.measure.MeasureResult" title="tvm.autotvm.measure.MeasureResult"><em>autotvm.measure.MeasureResult</em></a><em>)</em>) – The reference log</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<span class="target" id="module-tvm.autotvm.task.dispatcher"></span><p>Template dispatcher module.</p>
<p>A dispatcher is a function that can contains multiple behaviors.
Its specific behavior is can be controlled by DispatchContext.</p>
<p>DispatchContext is used in two ways, usually via different implementation
of the DispatchContext base class.</p>
<ul class="simple">
<li><p>During search, we can use it to pass the current proposal from tuner.</p></li>
<li><p>During evaluation, we can use it to set pick the best policy.</p></li>
</ul>
<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.task.dispatcher.DispatchContext">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.dispatcher.</span></span><span class="sig-name descname"><span class="pre">DispatchContext</span></span><a class="headerlink" href="#tvm.autotvm.task.dispatcher.DispatchContext" title="永久链接至目标">¶</a></dt>
<dd><p>Base class of dispatch context.</p>
<p>DispatchContext enables the target and workload
specific dispatch mechanism for templates.</p>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.dispatcher.DispatchContext.query">
<span class="sig-name descname"><span class="pre">query</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">target</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">workload</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.dispatcher.DispatchContext.query" title="永久链接至目标">¶</a></dt>
<dd><p>Query the context to get the specific config for a template.
If cannot find the result inside this context, this function will query it
from the upper contexts.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>target</strong> (<a class="reference internal" href="target.html#tvm.target.Target" title="tvm.target.Target"><em>Target</em></a>) – The current target</p></li>
<li><p><strong>workload</strong> (<a class="reference internal" href="topi.html#tvm.topi.nn.Workload" title="tvm.topi.nn.Workload"><em>Workload</em></a>) – The current workload.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>cfg</strong> – The specific configuration.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.autotvm.task.space.ConfigSpace" title="tvm.autotvm.task.space.ConfigSpace">ConfigSpace</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.dispatcher.DispatchContext.update">
<span class="sig-name descname"><span class="pre">update</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">target</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">workload</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cfg</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.dispatcher.DispatchContext.update" title="永久链接至目标">¶</a></dt>
<dd><p>Update context with a specific config.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>target</strong> (<a class="reference internal" href="target.html#tvm.target.Target" title="tvm.target.Target"><em>Target</em></a>) – The current target</p></li>
<li><p><strong>workload</strong> (<a class="reference internal" href="topi.html#tvm.topi.nn.Workload" title="tvm.topi.nn.Workload"><em>Workload</em></a>) – The current workload.</p></li>
<li><p><strong>cfg</strong> (<a class="reference internal" href="#tvm.autotvm.task.space.ConfigSpace" title="tvm.autotvm.task.space.ConfigSpace"><em>ConfigSpace</em></a>) – The specific configuration.</p></li>
</ul>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>This interface is for cases when TVM decides to replace an operator in the graph.
For example, <cite>AlterOpLayout</cite> pass (enables when <cite>opt_level = 3</cite>) replaces <cite>NCHW</cite>
convolution with <cite>NCHW[x]c</cite> implementation on x86 CPUs.
Thus in TOPI, we first query schedule using original <cite>NCHW</cite> workload,
then update the dispatcher with the new <cite>NCHW[x]c</cite> workload.
So that later on, <cite>NCHW[x]c</cite> convolution can get schedule from the dispatcher using
its own workload directly.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="nd">@conv2d_alter_layout.register</span><span class="p">(</span><span class="s2">&quot;cpu&quot;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">_alter_conv2d_layout</span><span class="p">(</span><span class="n">attrs</span><span class="p">,</span> <span class="n">inputs</span><span class="p">,</span> <span class="n">tinfo</span><span class="p">):</span>
    <span class="n">workload</span> <span class="o">=</span> <span class="n">get_conv2d_workload</span><span class="p">(</span><span class="o">...</span><span class="p">)</span>
    <span class="n">dispatch_ctx</span> <span class="o">=</span> <span class="n">autotvm</span><span class="o">.</span><span class="n">task</span><span class="o">.</span><span class="n">DispatchContext</span><span class="o">.</span><span class="n">current</span>
    <span class="n">target</span> <span class="o">=</span> <span class="n">tvm</span><span class="o">.</span><span class="n">target</span><span class="o">.</span><span class="n">Target</span><span class="o">.</span><span class="n">current</span><span class="p">()</span>
    <span class="n">config</span> <span class="o">=</span> <span class="n">dispatch_ctx</span><span class="o">.</span><span class="n">query</span><span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="n">workload</span><span class="p">)</span>

    <span class="c1"># Get conv2d_NCHWc workload from config</span>
    <span class="c1"># new_workload = ...</span>
    <span class="c1"># new_inputs = ...</span>
    <span class="c1"># new_attrs = ...</span>

    <span class="c1"># Store altered operator&#39;s config</span>
    <span class="n">dispatch_ctx</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="n">new_workload</span><span class="p">,</span> <span class="n">config</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">sym</span><span class="o">.</span><span class="n">contrib</span><span class="o">.</span><span class="n">conv2d_NCHWc</span><span class="p">(</span><span class="o">*</span><span class="n">new_inputs</span><span class="p">,</span> <span class="o">**</span><span class="n">new_attrs</span><span class="p">)</span>
</pre></div>
</div>
<p>We directly store <cite>config</cite> back because <cite>conv2d_NCHW</cite> and <cite>conv2d_NCHWc</cite>
share the same schedule parameters.
One can construct a new <cite>ConfigEntity</cite> if this is not the case.</p>
</div>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.task.dispatcher.ApplyConfig">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.dispatcher.</span></span><span class="sig-name descname"><span class="pre">ApplyConfig</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">config</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.dispatcher.ApplyConfig" title="永久链接至目标">¶</a></dt>
<dd><p>Apply a deterministic config entity for all queries.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>config</strong> (<a class="reference internal" href="#tvm.autotvm.task.space.ConfigSpace" title="tvm.autotvm.task.space.ConfigSpace"><em>ConfigSpace</em></a><em> or </em><a class="reference internal" href="#tvm.autotvm.task.space.ConfigEntity" title="tvm.autotvm.task.space.ConfigEntity"><em>ConfigEntity</em></a>) – The specific configuration we care about.</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.dispatcher.ApplyConfig.update">
<span class="sig-name descname"><span class="pre">update</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">target</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">workload</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cfg</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.dispatcher.ApplyConfig.update" title="永久链接至目标">¶</a></dt>
<dd><p>Override update</p>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.task.dispatcher.ApplyHistoryBest">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.dispatcher.</span></span><span class="sig-name descname"><span class="pre">ApplyHistoryBest</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">records</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.dispatcher.ApplyHistoryBest" title="永久链接至目标">¶</a></dt>
<dd><p>Apply the history best config</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>records</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em> or </em><em>iterator of</em><em> (</em><a class="reference internal" href="#tvm.autotvm.measure.MeasureInput" title="tvm.autotvm.measure.MeasureInput"><em>autotvm.measure.MeasureInput</em></a><em>, </em><a class="reference internal" href="#tvm.autotvm.measure.MeasureResult" title="tvm.autotvm.measure.MeasureResult"><em>autotvm.measure.MeasureResult</em></a><em>)</em>) – Collection of tuning records.
If is str, then it should be the filename of a records log file.
Each row of this file is an encoded record pair. Otherwise, it is an iterator.</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.dispatcher.ApplyHistoryBest.load">
<span class="sig-name descname"><span class="pre">load</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">records</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.dispatcher.ApplyHistoryBest.load" title="永久链接至目标">¶</a></dt>
<dd><p>Load records to this dispatch context</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>records</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em> or </em><em>iterator of</em><em> (</em><a class="reference internal" href="#tvm.autotvm.measure.MeasureInput" title="tvm.autotvm.measure.MeasureInput"><em>autotvm.measure.MeasureInput</em></a><em>, </em><a class="reference internal" href="#tvm.autotvm.measure.MeasureResult" title="tvm.autotvm.measure.MeasureResult"><em>autotvm.measure.MeasureResult</em></a><em>)</em>) – Collection of tuning records.
If is str, then it should be the filename of a records log file.
Each row of this file is an encoded record pair. Otherwise, it is an iterator.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.dispatcher.ApplyHistoryBest.update">
<span class="sig-name descname"><span class="pre">update</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">target</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">workload</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cfg</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.dispatcher.ApplyHistoryBest.update" title="永久链接至目标">¶</a></dt>
<dd><p>Update context with a specific config.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>target</strong> (<a class="reference internal" href="target.html#tvm.target.Target" title="tvm.target.Target"><em>Target</em></a>) – The current target</p></li>
<li><p><strong>workload</strong> (<a class="reference internal" href="topi.html#tvm.topi.nn.Workload" title="tvm.topi.nn.Workload"><em>Workload</em></a>) – The current workload.</p></li>
<li><p><strong>cfg</strong> (<a class="reference internal" href="#tvm.autotvm.task.space.ConfigSpace" title="tvm.autotvm.task.space.ConfigSpace"><em>ConfigSpace</em></a>) – The specific configuration.</p></li>
</ul>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>This interface is for cases when TVM decides to replace an operator in the graph.
For example, <cite>AlterOpLayout</cite> pass (enables when <cite>opt_level = 3</cite>) replaces <cite>NCHW</cite>
convolution with <cite>NCHW[x]c</cite> implementation on x86 CPUs.
Thus in TOPI, we first query schedule using original <cite>NCHW</cite> workload,
then update the dispatcher with the new <cite>NCHW[x]c</cite> workload.
So that later on, <cite>NCHW[x]c</cite> convolution can get schedule from the dispatcher using
its own workload directly.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="nd">@conv2d_alter_layout.register</span><span class="p">(</span><span class="s2">&quot;cpu&quot;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">_alter_conv2d_layout</span><span class="p">(</span><span class="n">attrs</span><span class="p">,</span> <span class="n">inputs</span><span class="p">,</span> <span class="n">tinfo</span><span class="p">):</span>
    <span class="n">workload</span> <span class="o">=</span> <span class="n">get_conv2d_workload</span><span class="p">(</span><span class="o">...</span><span class="p">)</span>
    <span class="n">dispatch_ctx</span> <span class="o">=</span> <span class="n">autotvm</span><span class="o">.</span><span class="n">task</span><span class="o">.</span><span class="n">DispatchContext</span><span class="o">.</span><span class="n">current</span>
    <span class="n">target</span> <span class="o">=</span> <span class="n">tvm</span><span class="o">.</span><span class="n">target</span><span class="o">.</span><span class="n">Target</span><span class="o">.</span><span class="n">current</span><span class="p">()</span>
    <span class="n">config</span> <span class="o">=</span> <span class="n">dispatch_ctx</span><span class="o">.</span><span class="n">query</span><span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="n">workload</span><span class="p">)</span>

    <span class="c1"># Get conv2d_NCHWc workload from config</span>
    <span class="c1"># new_workload = ...</span>
    <span class="c1"># new_inputs = ...</span>
    <span class="c1"># new_attrs = ...</span>

    <span class="c1"># Store altered operator&#39;s config</span>
    <span class="n">dispatch_ctx</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="n">new_workload</span><span class="p">,</span> <span class="n">config</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">sym</span><span class="o">.</span><span class="n">contrib</span><span class="o">.</span><span class="n">conv2d_NCHWc</span><span class="p">(</span><span class="o">*</span><span class="n">new_inputs</span><span class="p">,</span> <span class="o">**</span><span class="n">new_attrs</span><span class="p">)</span>
</pre></div>
</div>
<p>We directly store <cite>config</cite> back because <cite>conv2d_NCHW</cite> and <cite>conv2d_NCHWc</cite>
share the same schedule parameters.
One can construct a new <cite>ConfigEntity</cite> if this is not the case.</p>
</div>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.task.dispatcher.FallbackContext">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.dispatcher.</span></span><span class="sig-name descname"><span class="pre">FallbackContext</span></span><a class="headerlink" href="#tvm.autotvm.task.dispatcher.FallbackContext" title="永久链接至目标">¶</a></dt>
<dd><p>A fallback dispatch context.</p>
<p>Any tunable template can be called under this context.
This is the root context.</p>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.dispatcher.FallbackContext.clear_cache">
<span class="sig-name descname"><span class="pre">clear_cache</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">target</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">workload</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.dispatcher.FallbackContext.clear_cache" title="永久链接至目标">¶</a></dt>
<dd><p>Clear fallback cache. Pass the same argument as _query_inside to this function
to clean the cache.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>target</strong> (<a class="reference internal" href="target.html#tvm.target.Target" title="tvm.target.Target"><em>Target</em></a>) – The current target</p></li>
<li><p><strong>workload</strong> (<a class="reference internal" href="topi.html#tvm.topi.nn.Workload" title="tvm.topi.nn.Workload"><em>Workload</em></a>) – The current workload.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.dispatcher.FallbackContext.update">
<span class="sig-name descname"><span class="pre">update</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">target</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">workload</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cfg</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.dispatcher.FallbackContext.update" title="永久链接至目标">¶</a></dt>
<dd><p>Update context with a specific config.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>target</strong> (<a class="reference internal" href="target.html#tvm.target.Target" title="tvm.target.Target"><em>Target</em></a>) – The current target</p></li>
<li><p><strong>workload</strong> (<a class="reference internal" href="topi.html#tvm.topi.nn.Workload" title="tvm.topi.nn.Workload"><em>Workload</em></a>) – The current workload.</p></li>
<li><p><strong>cfg</strong> (<a class="reference internal" href="#tvm.autotvm.task.space.ConfigSpace" title="tvm.autotvm.task.space.ConfigSpace"><em>ConfigSpace</em></a>) – The specific configuration.</p></li>
</ul>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>This interface is for cases when TVM decides to replace an operator in the graph.
For example, <cite>AlterOpLayout</cite> pass (enables when <cite>opt_level = 3</cite>) replaces <cite>NCHW</cite>
convolution with <cite>NCHW[x]c</cite> implementation on x86 CPUs.
Thus in TOPI, we first query schedule using original <cite>NCHW</cite> workload,
then update the dispatcher with the new <cite>NCHW[x]c</cite> workload.
So that later on, <cite>NCHW[x]c</cite> convolution can get schedule from the dispatcher using
its own workload directly.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="nd">@conv2d_alter_layout.register</span><span class="p">(</span><span class="s2">&quot;cpu&quot;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">_alter_conv2d_layout</span><span class="p">(</span><span class="n">attrs</span><span class="p">,</span> <span class="n">inputs</span><span class="p">,</span> <span class="n">tinfo</span><span class="p">):</span>
    <span class="n">workload</span> <span class="o">=</span> <span class="n">get_conv2d_workload</span><span class="p">(</span><span class="o">...</span><span class="p">)</span>
    <span class="n">dispatch_ctx</span> <span class="o">=</span> <span class="n">autotvm</span><span class="o">.</span><span class="n">task</span><span class="o">.</span><span class="n">DispatchContext</span><span class="o">.</span><span class="n">current</span>
    <span class="n">target</span> <span class="o">=</span> <span class="n">tvm</span><span class="o">.</span><span class="n">target</span><span class="o">.</span><span class="n">Target</span><span class="o">.</span><span class="n">current</span><span class="p">()</span>
    <span class="n">config</span> <span class="o">=</span> <span class="n">dispatch_ctx</span><span class="o">.</span><span class="n">query</span><span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="n">workload</span><span class="p">)</span>

    <span class="c1"># Get conv2d_NCHWc workload from config</span>
    <span class="c1"># new_workload = ...</span>
    <span class="c1"># new_inputs = ...</span>
    <span class="c1"># new_attrs = ...</span>

    <span class="c1"># Store altered operator&#39;s config</span>
    <span class="n">dispatch_ctx</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="n">new_workload</span><span class="p">,</span> <span class="n">config</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">sym</span><span class="o">.</span><span class="n">contrib</span><span class="o">.</span><span class="n">conv2d_NCHWc</span><span class="p">(</span><span class="o">*</span><span class="n">new_inputs</span><span class="p">,</span> <span class="o">**</span><span class="n">new_attrs</span><span class="p">)</span>
</pre></div>
</div>
<p>We directly store <cite>config</cite> back because <cite>conv2d_NCHW</cite> and <cite>conv2d_NCHWc</cite>
share the same schedule parameters.
One can construct a new <cite>ConfigEntity</cite> if this is not the case.</p>
</div>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.autotvm.task.dispatcher.clear_fallback_cache">
<span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.dispatcher.</span></span><span class="sig-name descname"><span class="pre">clear_fallback_cache</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">target</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">workload</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.dispatcher.clear_fallback_cache" title="永久链接至目标">¶</a></dt>
<dd><p>Clear fallback cache. Pass the same argument as _query_inside to this function
to clean the cache.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>target</strong> (<a class="reference internal" href="target.html#tvm.target.Target" title="tvm.target.Target"><em>Target</em></a>) – The current target</p></li>
<li><p><strong>workload</strong> (<a class="reference internal" href="topi.html#tvm.topi.nn.Workload" title="tvm.topi.nn.Workload"><em>Workload</em></a>) – The current workload.</p></li>
</ul>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>This is used in alter_op_layout to clear the bad cache created before call topi compute function</p>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.task.dispatcher.ApplyGraphBest">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.dispatcher.</span></span><span class="sig-name descname"><span class="pre">ApplyGraphBest</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">records</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.dispatcher.ApplyGraphBest" title="永久链接至目标">¶</a></dt>
<dd><p>Load the graph level tuning optimal schedules.</p>
<p>The input records should be in the ascending order of
node index for target operator. Usually this can be obtained
with graph tuner.</p>
<p>This context maintains an internal counter to indicate the current
node index.</p>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.dispatcher.ApplyGraphBest.update">
<span class="sig-name descname"><span class="pre">update</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">target</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">workload</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cfg</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.dispatcher.ApplyGraphBest.update" title="永久链接至目标">¶</a></dt>
<dd><p>Update context with a specific config.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>target</strong> (<a class="reference internal" href="target.html#tvm.target.Target" title="tvm.target.Target"><em>Target</em></a>) – The current target</p></li>
<li><p><strong>workload</strong> (<a class="reference internal" href="topi.html#tvm.topi.nn.Workload" title="tvm.topi.nn.Workload"><em>Workload</em></a>) – The current workload.</p></li>
<li><p><strong>cfg</strong> (<a class="reference internal" href="#tvm.autotvm.task.space.ConfigSpace" title="tvm.autotvm.task.space.ConfigSpace"><em>ConfigSpace</em></a>) – The specific configuration.</p></li>
</ul>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>This interface is for cases when TVM decides to replace an operator in the graph.
For example, <cite>AlterOpLayout</cite> pass (enables when <cite>opt_level = 3</cite>) replaces <cite>NCHW</cite>
convolution with <cite>NCHW[x]c</cite> implementation on x86 CPUs.
Thus in TOPI, we first query schedule using original <cite>NCHW</cite> workload,
then update the dispatcher with the new <cite>NCHW[x]c</cite> workload.
So that later on, <cite>NCHW[x]c</cite> convolution can get schedule from the dispatcher using
its own workload directly.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="nd">@conv2d_alter_layout.register</span><span class="p">(</span><span class="s2">&quot;cpu&quot;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">_alter_conv2d_layout</span><span class="p">(</span><span class="n">attrs</span><span class="p">,</span> <span class="n">inputs</span><span class="p">,</span> <span class="n">tinfo</span><span class="p">):</span>
    <span class="n">workload</span> <span class="o">=</span> <span class="n">get_conv2d_workload</span><span class="p">(</span><span class="o">...</span><span class="p">)</span>
    <span class="n">dispatch_ctx</span> <span class="o">=</span> <span class="n">autotvm</span><span class="o">.</span><span class="n">task</span><span class="o">.</span><span class="n">DispatchContext</span><span class="o">.</span><span class="n">current</span>
    <span class="n">target</span> <span class="o">=</span> <span class="n">tvm</span><span class="o">.</span><span class="n">target</span><span class="o">.</span><span class="n">Target</span><span class="o">.</span><span class="n">current</span><span class="p">()</span>
    <span class="n">config</span> <span class="o">=</span> <span class="n">dispatch_ctx</span><span class="o">.</span><span class="n">query</span><span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="n">workload</span><span class="p">)</span>

    <span class="c1"># Get conv2d_NCHWc workload from config</span>
    <span class="c1"># new_workload = ...</span>
    <span class="c1"># new_inputs = ...</span>
    <span class="c1"># new_attrs = ...</span>

    <span class="c1"># Store altered operator&#39;s config</span>
    <span class="n">dispatch_ctx</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="n">new_workload</span><span class="p">,</span> <span class="n">config</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">sym</span><span class="o">.</span><span class="n">contrib</span><span class="o">.</span><span class="n">conv2d_NCHWc</span><span class="p">(</span><span class="o">*</span><span class="n">new_inputs</span><span class="p">,</span> <span class="o">**</span><span class="n">new_attrs</span><span class="p">)</span>
</pre></div>
</div>
<p>We directly store <cite>config</cite> back because <cite>conv2d_NCHW</cite> and <cite>conv2d_NCHWc</cite>
share the same schedule parameters.
One can construct a new <cite>ConfigEntity</cite> if this is not the case.</p>
</div>
</dd></dl>

</dd></dl>

<span class="target" id="module-tvm.autotvm.task.topi_integration"></span><p>Decorators for registering tunable templates to TOPI.</p>
<p>These decorators can make your simple implementation be able to use different configurations
for different workloads.
Here we directly use all arguments to the TOPI call as “workload”, so make sure all the arguments
(except tvm.te.Tensor) in you calls are hashable. For tvm.te.Tensor,
we will serialize it to a hashable tuple.</p>
<p>See tvm/topi/python/topi/arm_cpu/depthwise_conv2d.py for example usage.</p>
<dl class="py class">
<dt class="sig sig-object py" id="tvm.autotvm.task.topi_integration.TaskExtractEnv">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.topi_integration.</span></span><span class="sig-name descname"><span class="pre">TaskExtractEnv</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">allow_duplicate</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.topi_integration.TaskExtractEnv" title="永久链接至目标">¶</a></dt>
<dd><p>Global environment for extracting tuning tasks from graph</p>
<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.topi_integration.TaskExtractEnv.reset">
<span class="sig-name descname"><span class="pre">reset</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">wanted_relay_ops</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.topi_integration.TaskExtractEnv.reset" title="永久链接至目标">¶</a></dt>
<dd><p>Reset task collections</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>wanted_relay_ops</strong> (<em>List of tvm.ir.Op</em>) – The relay ops to be extracted</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.topi_integration.TaskExtractEnv.add_task">
<span class="sig-name descname"><span class="pre">add_task</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">task_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.topi_integration.TaskExtractEnv.add_task" title="永久链接至目标">¶</a></dt>
<dd><p>Add AutoTVM task</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>task_name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – AutoTVM task name.</p></li>
<li><p><strong>args</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#tuple" title="(在 Python v3.10)"><em>tuple</em></a>) – Arguments to the TOPI function.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.topi_integration.TaskExtractEnv.get_tasks">
<span class="sig-name descname"><span class="pre">get_tasks</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.topi_integration.TaskExtractEnv.get_tasks" title="永久链接至目标">¶</a></dt>
<dd><p>Get collected tasks</p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><strong>tasks</strong> – A list of tasks extracted from the graph</p>
</dd>
<dt class="field-even">返回类型</dt>
<dd class="field-even"><p>List of tuple(name, args)</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="tvm.autotvm.task.topi_integration.TaskExtractEnv.get">
<em class="property"><span class="pre">static</span> </em><span class="sig-name descname"><span class="pre">get</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">allow_duplicate</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.topi_integration.TaskExtractEnv.get" title="永久链接至目标">¶</a></dt>
<dd><p>Get the single instance of TaskExtractEnv</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>allow_duplicate</strong> (<em>boolean</em>) – Whether to fetch all workloads in the network,
even though some of them are the same. This is
useful for graph tuning.</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>env</strong> – The single instance of TaskExtractEnv</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference internal" href="#tvm.autotvm.task.topi_integration.TaskExtractEnv" title="tvm.autotvm.task.topi_integration.TaskExtractEnv">TaskExtractEnv</a></p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.autotvm.task.topi_integration.register_topi_compute">
<span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.topi_integration.</span></span><span class="sig-name descname"><span class="pre">register_topi_compute</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">task_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">func</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.topi_integration.register_topi_compute" title="永久链接至目标">¶</a></dt>
<dd><p>Register a tunable template for a topi compute function.</p>
<p>The registration will wrap this topi compute to take <cite>cfg</cite> as the first argument,
followed by the original argument list. It uses all its argument as workload and
stores this “workload” to its final ComputeOp, which can be used to reconstruct
“workload” in the following topi_schedule call.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>task_name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The AutoTVM task name</p></li>
<li><p><strong>func</strong> (<a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(在 Python v3.10)"><em>None</em></a><em> or </em><em>callable</em>) – If it is None, return a decorator.
If is callable, decorate this function.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>decorator</strong> – A decorator</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>callable</p>
</dd>
</dl>
<p class="rubric">实际案例</p>
<p>See tvm/topi/python/topi/arm_cpu/depthwise_conv2d.py for example usage.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.autotvm.task.topi_integration.register_topi_schedule">
<span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.topi_integration.</span></span><span class="sig-name descname"><span class="pre">register_topi_schedule</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">task_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">func</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.topi_integration.register_topi_schedule" title="永久链接至目标">¶</a></dt>
<dd><p>Register a tunable template for a topi schedule function.</p>
<p>The registration will wrap this topi schedule to take <cite>cfg</cite> as the first argument,
followed by the original argument list.</p>
<p>Note that this function will try to find “workload” from all the ComputeOp in the input.
You can attach “workload” to your compute op by using <a class="reference internal" href="#tvm.autotvm.task.topi_integration.register_topi_compute" title="tvm.autotvm.task.topi_integration.register_topi_compute"><code class="xref any py py-func docutils literal notranslate"><span class="pre">register_topi_compute</span></code></a>.</p>
<p>The task name has to be the same as that of the corresponding topi compute function.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>task_name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The AutoTVM task name</p></li>
<li><p><strong>func</strong> (<a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(在 Python v3.10)"><em>None</em></a><em> or </em><em>callable</em>) – If it is None, return a decorator.
If is callable, decorate this function.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>decorator</strong> – A decorator</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p>callable</p>
</dd>
</dl>
<p class="rubric">实际案例</p>
<p>See tvm/topi/python/topi/arm_cpu/depthwise_conv2d.py for example usage.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.autotvm.task.topi_integration.get_workload">
<span class="sig-prename descclassname"><span class="pre">tvm.autotvm.task.topi_integration.</span></span><span class="sig-name descname"><span class="pre">get_workload</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">outs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">task_name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.task.topi_integration.get_workload" title="永久链接至目标">¶</a></dt>
<dd><p>Retrieve the workload from outputs</p>
</dd></dl>

</div>
<div class="section" id="module-tvm.autotvm.record">
<span id="tvm-autotvm-record"></span><h2>tvm.autotvm.record<a class="headerlink" href="#module-tvm.autotvm.record" title="永久链接至标题">¶</a></h2>
<p>Tuning record and serialization format</p>
<dl class="py function">
<dt class="sig sig-object py" id="tvm.autotvm.record.measure_str_key">
<span class="sig-prename descclassname"><span class="pre">tvm.autotvm.record.</span></span><span class="sig-name descname"><span class="pre">measure_str_key</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">inp</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">include_config</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.record.measure_str_key" title="永久链接至目标">¶</a></dt>
<dd><p>get unique str key for MeasureInput</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>inp</strong> (<a class="reference internal" href="#tvm.autotvm.measure.MeasureInput" title="tvm.autotvm.measure.MeasureInput"><em>autotvm.measure.MeasureInput</em></a>) – input for the measure</p></li>
<li><p><strong>include_config</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a><em>, </em><em>optional</em>) – whether includes config in the str key</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>key</strong> – The str representation of key</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)">str</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.autotvm.record.encode">
<span class="sig-prename descclassname"><span class="pre">tvm.autotvm.record.</span></span><span class="sig-name descname"><span class="pre">encode</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">inp</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">result</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">protocol</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'json'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.record.encode" title="永久链接至目标">¶</a></dt>
<dd><p>encode (MeasureInput, MeasureResult) pair to a string</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>inp</strong> (<a class="reference internal" href="#tvm.autotvm.measure.MeasureInput" title="tvm.autotvm.measure.MeasureInput"><em>autotvm.measure.MeasureInput</em></a>) – </p></li>
<li><p><strong>result</strong> (<a class="reference internal" href="#tvm.autotvm.measure.MeasureResult" title="tvm.autotvm.measure.MeasureResult"><em>autotvm.measure.MeasureResult</em></a>) – pair of input/result</p></li>
<li><p><strong>protocol</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – log protocol, json or pickle</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>row</strong> – a row in the logger file</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)">str</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.autotvm.record.decode">
<span class="sig-prename descclassname"><span class="pre">tvm.autotvm.record.</span></span><span class="sig-name descname"><span class="pre">decode</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">row</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">protocol</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'json'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.record.decode" title="永久链接至目标">¶</a></dt>
<dd><p>Decode encoded record string to python object</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>row</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – a row in the logger file</p></li>
<li><p><strong>protocol</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – log protocol, json or pickle</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><strong>ret</strong> – The tuple of input and result, or None if input uses old version log format.</p>
</dd>
<dt class="field-odd">返回类型</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#tuple" title="(在 Python v3.10)">tuple</a>(<a class="reference internal" href="#tvm.autotvm.measure.MeasureInput" title="tvm.autotvm.measure.MeasureInput">autotvm.measure.MeasureInput</a>, <a class="reference internal" href="#tvm.autotvm.measure.MeasureResult" title="tvm.autotvm.measure.MeasureResult">autotvm.measure.MeasureResult</a>), or <a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(在 Python v3.10)">None</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.autotvm.record.load_from_file">
<span class="sig-prename descclassname"><span class="pre">tvm.autotvm.record.</span></span><span class="sig-name descname"><span class="pre">load_from_file</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">filename</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.record.load_from_file" title="永久链接至目标">¶</a></dt>
<dd><p>Generator: load records from file.
This is a generator that yields the records.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – </p>
</dd>
<dt class="field-even">生成器</dt>
<dd class="field-even"><ul class="simple">
<li><p><strong>input</strong> (<em>autotvm.measure.MeasureInput</em>)</p></li>
<li><p><strong>result</strong> (<em>autotvm.measure.MeasureResult</em>)</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.autotvm.record.split_workload">
<span class="sig-prename descclassname"><span class="pre">tvm.autotvm.record.</span></span><span class="sig-name descname"><span class="pre">split_workload</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">in_file</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">clean</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.record.split_workload" title="永久链接至目标">¶</a></dt>
<dd><p>Split a log file into separate files, each of which contains only a single workload
This function can also delete duplicated records in log file</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>in_file</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – input filename</p></li>
<li><p><strong>clean</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(在 Python v3.10)"><em>bool</em></a>) – whether delete duplicated items</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="tvm.autotvm.record.pick_best">
<span class="sig-prename descclassname"><span class="pre">tvm.autotvm.record.</span></span><span class="sig-name descname"><span class="pre">pick_best</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">in_file</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">out_file</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#tvm.autotvm.record.pick_best" title="永久链接至目标">¶</a></dt>
<dd><p>Pick the best entries from a file and store them to another file.
This function distills the useful log entries from a large log file.
If out_file already exists, the best entries from both
in_file and out_file will be saved.</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>in_file</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a>) – The filename of input</p></li>
<li><p><strong>out_file</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(在 Python v3.10)"><em>str</em></a><em> or </em><em>file</em>) – The filename of output</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</div>
</div>


           </div>
           
          </div>
          

<footer>

    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="auto_scheduler.html" class="btn btn-neutral float-right" title="tvm.auto_scheduler" accesskey="n" rel="next">下一个 <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="relay/testing.html" class="btn btn-neutral float-left" title="tvm.relay.testing" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> 上一个</a>
      
    </div>

<div id="button" class="backtop"><img src="../../../_static//img/right.svg" alt="backtop"/> </div>
<section class="footerSec">
    <div class="footerHeader">
      <ul class="d-flex align-md-items-center justify-content-between flex-column flex-md-row">
        <li class="copywrite d-flex align-items-center">
          <h5 id="copy-right-info">© 2020 Apache Software Foundation | All right reserved</h5>
        </li>
      </ul>

    </div>

    <ul>
      <li class="footernote">Copyright © 2020 The Apache Software Foundation. Apache TVM, Apache, the Apache feather, and the Apache TVM project logo are either trademarks or registered trademarks of the Apache Software Foundation.</li>
    </ul>

</section>
</footer>
        </div>
      </div>

    </section>

  </div>
  

    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

  </body>
  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
    <!-- Theme Analytics -->
    <script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

    ga('create', 'UA-75982049-2', 'auto');
    ga('send', 'pageview');
    </script>

    
   

</body>
</html>